我在我的网站颜色框弹出插件和 coda 内容 slider 中使用了两个 jQuery 插件
1- http://colorpowered.com/colorbox/
2- http://www.ndoherty.biz/demos/coda-slider/2.0/
这两者似乎是相互冲突的。我已经按照这个顺序添加了需要的JS文件
<!-- jQuery library -->
<script src="<?php bloginfo('template_url'); ?>/colorbox/jquery-1.5.1.js"></script>
<!-- Coda Slider -->
<link type="text/css" href="<?php bloginfo('template_url');?>/coda/codastyle.css" rel="stylesheet" />
<script type="text/javascript" src="<?php bloginfo('template_url');?>/coda /js/jquery.easing.1.3.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_url');?>/coda/js/jquery.coda-slider-2.0.js"></script>
<!-- jQuery Colorbox Popup -->
<link media="screen" rel="stylesheet" href="<?php bloginfo('template_url'); ?>/colorbox/colorbox.css" />
<script src="<?php bloginfo('template_url'); ?>/colorbox/jquery.colorbox.js"></script>
独立地,两个插件都可以正常工作。但是当一起使用时,我会在 Firebug 中遇到不同的错误。这是我现在遇到的错误
jQuery.easing[jQuery.easing.def] is not a function
[Break On This Error] return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
这些插件肯定相互冲突。 有什么解决办法吗?可以使用多个 jQuery 实例吗?
最佳答案
coda slider 插件有点旧(jQuery 1.3.2),带有外部 jquery.easing.js
……好吧,坦率地说,它搞砸了更新的 jQuery 版本。
我认为目前为止最简单的解决方案是为尾声 slider 效果使用另一个插件,那里有几个选项,例如:http://jqueryfordesigners.com/coda-slider-effect/ ( demo here )
关于javascript - 多个 jQuery 实例和 jQuery 插件生成错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7024829/