Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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