Created
November 18, 2016 09:08
-
-
Save Bosc85/69f155f2ba225c25532433fe7e735b6f to your computer and use it in GitHub Desktop.
resolve conflicts between bootstrap 3 and prototype on a magento website, include this after jquery and prototype
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var isBootstrapEvent = false; | |
if (window.jQuery) { | |
var all = jQuery('*'); | |
jQuery.each(['hide.bs.dropdown', | |
'hide.bs.collapse', | |
'hide.bs.modal', | |
'hide.bs.tooltip', | |
'hide.bs.popover', | |
'hide.bs.tab'], function(index, eventName) { | |
all.on(eventName, function( event ) { | |
isBootstrapEvent = true; | |
}); | |
}); | |
} | |
var originalHide = Element.hide; | |
Element.addMethods({ | |
hide: function(element) { | |
if(isBootstrapEvent) { | |
isBootstrapEvent = false; | |
return element; | |
} | |
return originalHide(element); | |
} | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment