Guest User

Untitled

a guest
Nov 18th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 KB | None | 0 0
  1. # General event handler for showing, hiding, and toggling elements.
  2. #
  3. # Usage: <a href="x" data-show="#my_form">
  4. # If #my_form exists, we'll call show() on it.
  5. # Otherwise, we'll follow the link to x.
  6. $(document).on 'click', 'a[data-toggle], a[data-show], a[data-hide]', (e) ->
  7. link = $(@)
  8. for opt in ['toggle', 'show', 'hide']
  9. if link.data(opt)? && $(link.data(opt)).length > 0
  10. $(link.data(opt))[opt]()
  11. e.preventDefault() unless e.isDefaultPrevented()
Add Comment
Please, Sign In to add comment