Skip to content

Instantly share code, notes, and snippets.

@Bosc85
Created November 18, 2016 09:08
Show Gist options
  • Save Bosc85/69f155f2ba225c25532433fe7e735b6f to your computer and use it in GitHub Desktop.
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
(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