对于jQuery自身不同版本的冲突问题,和jQuery和其他引入库的问题,我们可以参看 http://api.jquery.com/jQuery.noConflict/ 来解决,在我使用的过程中遇到了jQuery库和prototype库的冲突的问题。
然后比较抵触使用其他符号替代jQuery当中的$符号,因而
This technique is especially effective in conjunction with the .ready()
method's ability to alias the jQuery object, as within callback passed to .ready()
you can use $
if you wish without fear of conflicts later:
1
2
3
4
5
6
7
8
9
|
|
用这段代码替代了
var loadmore = document.getElementById('loadMore');
loadmore.addEventListener('click', function() {
$(".section1").css("height", "962px");
$(".section1").css("background-image", "url(http://www.annkestore.com/media/topic/20160120/haikan11big.jpg)");
$(".panel2").show();
$(".moreClick").hide();
}, false);
急用addEventListenner替代onclick方法。
另外在stackoverflow上的这个地址http://stackoverflow.com/questions/7532124/jquery-prototype-conflicts-in-magento/7532172#7532172
找到了解决方法
If you want to include the jquery and no conflict code in your local.xml then use:
<default>
<reference name="head">
<block type="core/text" name="google.cdn.jquery">
<action method="setText">
<text><![CDATA[<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script><script type="text/javascript">jQuery.noConflict();</script>]]>
</text>
</action>
</block>
</reference>
</default>