简体   繁体   中英

Conflicting jquery.min.js

I am using two different modules that both have jquery.min.js in my joomla site. They are conflicting on my homepage. How can I distinguish between them for the homepage and for the inside pages where the conflict does not occur?

I have faced this problem before, each module loads its own jQuery and conflicts each other.

The solution i have implemented is installing a plugin that prevents the modules from loading jQuery.js and loads only one. Try one of these, maybe it requires little tweaks to fully work:

Sc Jquery

jQuery Easy

$jQ = jQuery.noConflict();
$jQ("document").ready(function(){


// all the Code for Module X


});
(function($){

  // code here, you could even use $ here as you like

})(jQuery);

正如Sushil Bharwani所说:您应该在添加jquery.min.js之后立即在标题中添加<script type="text/javascript">jQuery = jQuery.noConflict();</script>另外,请确保替换所有“ $'和JS代码中的'jQuery'。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM