Magento的Prototype与Bootstrap冲突问题及解决

Magento引入Bootstrap的时候,会产生冲突问题,最明显的就是dropdown等控件在选择的时候会把整个控件给hide了

解决办法

修改 prototype.js 文件,最开头加入下面代码

var isBootstrapEvent = false;
if (window.jQuery) {  
  jQuery('*').on('hide.bs.dropdown', function( event ) {
    isBootstrapEvent = true;
  });
  jQuery('*').on('hide.bs.collapse', function( event ) {
    isBootstrapEvent = true;
  });
  jQuery('*').on('hide.bs.modal', function( event ) {
    isBootstrapEvent = true;
  });
}

大概1931行 修改为

    if(!isBootstrapEvent){
        element.style.display = 'none';
    }