两种jQuery对象冲突 [英] Two jQuery object conflict
本文介绍了两种jQuery对象冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我遇到了这个问题,我无法在页面上使用两个基于jQuery的对象.根据位置,on或其他似乎无法正常工作.
I'm having this problem, I can't get to work two jQuery based objects on my page. According to placement, on or other doesn't seem to work properly.
此刻,代码对此进行了探讨:
Codes looks about this at the moment :
<script type="text/javascript" src="jquery-1.2.6.min.js"></script>
<script type="text/javascript" src="jquery-ui-personalized-1.5.2.packed.js"></script>
<script type="text/javascript" src="sprinkle.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script src="js/slides.min.jquery.js"></script>
<script>
$(function(){
$('#slides').slides({
preload: true,
generateNextPrev: false
});
});
</script>
我没有选择权,对如何使这些人一起工作有任何想法吗?
I'm out of options, any ideas how to get these guys to work together?
推荐答案
您实际上不应该同时使用两个jQuery
版本,但是如果您必须:
You're really not supposed to use two jQuery
versions together at the same time, but if you must:
<script type="text/javascript" src="jquery-1.2.6.min.js"></script>
<script>
$jq1 = $.noConflict(true);
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script>
$jq2 = $.noConflict(true);
</script>
现在您将1.2.6
版本命名为$jq1
,将另一个版本命名为$jq2
:
Now you have the 1.2.6
version as $jq1
and the other as $jq2
:
$jq1(function(){
$jq1('#slides').slides({
preload: true,
generateNextPrev: false
});
});
这篇关于两种jQuery对象冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文