Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # General event handler for showing, hiding, and toggling elements.
- #
- # Usage: <a href="x" data-show="#my_form">
- # If #my_form exists, we'll call show() on it.
- # Otherwise, we'll follow the link to x.
- $(document).on 'click', 'a[data-toggle], a[data-show], a[data-hide]', (e) ->
- link = $(@)
- for opt in ['toggle', 'show', 'hide']
- if link.data(opt)? && $(link.data(opt)).length > 0
- $(link.data(opt))[opt]()
- e.preventDefault() unless e.isDefaultPrevented()
Add Comment
Please, Sign In to add comment