是否有可能在 html 页面中使用 2 个不同的 jquery?我发现一些博客说使用冲突。但是我尝试添加但没有运气。任何人都可以在这里帮助我吗?
这是我的代码:产品 slider
<link href="assets/js/google-code-prettify/prettify.css" rel="stylesheet">
<script src="assets/js/google-code-prettify/prettify.js"></script>
<script src="assets/js/application.js"></script>
<script src="assets/js/jquery-1.9.1.min.js"></script>
<script src="owl-carousel/owl.carousel.js"></script>
<script src="js/lightbox.js"></script>
<style>
#owl-demo .item{
margin: 3px;
}
#owl-demo .item img{
display: block;
width: 100%;
height: auto;
}
</style>
<script>
$(document).ready(function() {
$("#owl-demo").owlCarousel({
autoPlay: 3000,
items : 4,
itemsDesktop : [1199,3],
itemsDesktopSmall : [979,3]
});
});
</script>
幻灯片
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/scripts.js"></script>
<script src="sliderengine/jquery.js"></script>
<script src="sliderengine/amazingslider.js"></script>
<link rel="stylesheet" type="text/css" href="sliderengine/amazingslider-1.css">
<script src="sliderengine/initslider-1.js"></script>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true"></script>
如果你想使用多个版本的 jQuery,请尝试以下解决方案伙伴.. :)
<!-- load jQuery 2.2.1 -->
<script type="text/javascript" src="jquery-2.2.1.js"></script>
<script type="text/javascript">
var jQuery221 = $.noConflict(true);
</script>
<!-- load jQuery 1.10 -->
<script type="text/javascript" src="jquery-1.10.js"></script>
<script type="text/javascript">
var jQuery110 = $.noConflict(true);
</script>
然后使用适当版本的 jquery 变量来调用所需的插件。希望这能给你一个想法伙伴.. :)
如下修改你的资源
<!-- jQuery for Product slider -->
<script src="assets/js/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
var jQuery191 = $.noConflict(true);
</script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<!-- jQuery for Product slider -->
<script src="sliderengine/jquery.js"></script>
<script type="text/javascript">
var jQuerySlideshow = $.noConflict(true);
</script>
<!-- Product slider -->
<script src="assets/js/google-code-prettify/prettify.js"></script>
<script src="assets/js/application.js"></script>
<script src="owl-carousel/owl.carousel.js"></script>
<script src="js/lightbox.js"></script>
<!-- Slideshow -->
<script type="text/javascript" src="js/scripts.js"></script>
<script src="sliderengine/amazingslider.js"></script>
<script src="sliderengine/initslider-1.js"></script>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true"></script>
我是一名优秀的程序员,十分优秀!