Skip to content

Instantly share code, notes, and snippets.

@zimkies
Last active March 23, 2016 20:39
Show Gist options
  • Save zimkies/8360181 to your computer and use it in GitHub Desktop.
Save zimkies/8360181 to your computer and use it in GitHub Desktop.
MonkeyPatch for Jquery hide() and show() to work with Bootstrap 3
# MonkeyPatch for Jquery hide() and show() to work with Bootstrap 3
#
# Bootstrap 3 defines hidden and hide with the !important marker which
# prevents .show() and .hide() from working on elements that have been
# hidden using these classes.
# This patch modifies the hide and show to simply add and remove these
(($) ->
show = $.fn.show
$.fn.show = ->
@removeClass("hidden hide")
show.apply(this, arguments)
hide = $.fn.hide
$.fn.hide = ->
@addClass("hidden hide")
hide.apply(this, arguments)
)(jQuery)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment