简体   繁体   English

如何解决jquery和mootools 1.11之间的冲突?

[英]How to resolve the conflict between jquery and mootools 1.11?

the slide show in my page stops working when I add the mootools script. 添加mootools脚本后,页面中的幻灯片播放将停止工作。 How to resolve that? 如何解决?

    <!--Script-->
<script type='text/javascript' src="js/jquery.1.3.2.js"></script>
<script type='text/javascript' src='js/jquery.cycle.all.min.js'></script>
<script type='text/javascript' src='js/presentationCycle.js'></script>

<!--mootools for dropdown-->
<script type="text/javascript" src="js/mootools.js"></script>
<script type="text/javascript" src="js/elSelect.js"></script>



<script type="text/javascript">
<!---//
window.addEvent('domready', function(){
var mySelect = new elSelect( {container : 'mySelect'} );

var mySelect2 = new elSelect( {container : 'mySelect2'} );

var mySelect3 = new elSelect( {container : 'mySelect3'} );

var mySelect4 = new elSelect( {container : 'mySelect4'} );
});
//-->
</script>

presentationCycle.js is badly written - it uses $ instead of jQuery (and $ is used also by mootools) presentationCycle.js编写得很糟糕-它使用$而不是jQuery(并且$也被mootools使用)

You have to enclose presentationCycle in: 您必须将presentationCycle包含在以下内容中:

(function($) {
    ...
})(jQuery);

apart from that, read: 除此之外,请阅读:

http://api.jquery.com/jQuery.noConflict/ http://api.jquery.com/jQuery.noConflict/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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