gpt4 book ai didi

colorbox - 如何使两种类型的jquery脚本不冲突

转载 作者:行者123 更新时间:2023-12-01 06:03:55 26 4
gpt4 key购买 nike

我不是 jQuery 人,但愿我是。我没有处理任何冲突,但它仍然一次只允许一个脚本工作,而不是同时工作。我正在使用滚动到jquery脚本和colorbox(如lightbox)这是我的代码。任何帮助都很棒。

    <!--jquery scroll-->

<script src="js_scroll/jquery.js"></script>
<script src="js_scroll/jquery.scrollTo.js"></script>
<script src="js_scroll/jquery.nav.js"></script>
<script>

$(document).ready(function() {$('#nav').onePageNav();});

</script>


<!--colorbox-->
<link rel="stylesheet" href="colorbox.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<script src="colorbox/jquery.colorbox.js"></script>
<script>
$(document).ready(function(){
//Examples of how to assign the ColorBox event to elements
$(".group1").colorbox({rel:'group1'});
$(".group2").colorbox({rel:'group2', transition:"fade"});
$(".group3").colorbox({rel:'group3', transition:"none", width:"75%", height:"75%"});
$(".group4").colorbox({rel:'group4', slideshow:true});
$(".ajax").colorbox();
$(".youtube").colorbox({iframe:true, innerWidth:425, innerHeight:344});
$(".iframe").colorbox({iframe:true, width:"80%", height:"80%"});
$(".inline").colorbox({inline:true, width:"50%"});
$(".callbacks").colorbox({
onOpen:function(){ alert('onOpen: colorbox is about to open'); },
onLoad:function(){ alert('onLoad: colorbox has started to load the targeted content'); },
onComplete:function(){ alert('onComplete: colorbox has displayed the loaded content'); },
onCleanup:function(){ alert('onCleanup: colorbox has begun the close process'); },
onClosed:function(){ alert('onClosed: colorbox has completely closed'); }
});

//Example of preserving a JavaScript event for inline calls.
$("#click").click(function(){
$('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
return false;
});
});
</script>

</body>

最佳答案

如果你想加载多个 jQuery 库,就是这样。

<script src='jquery-1.3.2.js'></script>
<script>
var $j132 = jQuery.noConflict();
</script>

<script src='jquery-1.4.2.js'></script>
<script>
var $j142 = jQuery.noConflict();
</script>

现在使用 $j132() 进行 jQuery 1.3.2 操作,使用 $j142() 进行 jQuery 1.4.2

关于colorbox - 如何使两种类型的jquery脚本不冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8419059/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com