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

时间:2011-08-07 10:05:56

标签: javascript html mootools

当我添加mootools脚本时,我页面中的幻灯片停止工作。如何解决?

    <!--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>

1 个答案:

答案 0 :(得分:1)

presentationCycle.js编写得很糟糕 - 它使用$而不是jQuery(而且mootools也使用$)

您必须将presentationCycle包含在:

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

除此之外,请阅读:

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