javascript - 多个 jQuery 实例和 jQuery 插件生成错误

标签 javascript jquery

我在我的网站颜色框弹出插件和 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 )

...或者,如果您不特别关注该效果,那么有很多 other sliders out there .

关于javascript - 多个 jQuery 实例和 jQuery 插件生成错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7024829/

相关文章:

javascript - JavaScript 中的可滚动菜单

javascript - CDNJS 的 fullcalendar.js 不起作用?

javascript - 使用 Jasmine 测试 DOM 元素

javascript - 在 HTML 中的引号之间打印 javascript 变量

javascript - Bootstrap 轮播和 Django

javascript - 有没有办法在 chrome 调试器中暂停卡住的脚本?

jQuery函数源代码

javascript - 使用 jQuery/javascript 验证联系表单中的电子邮件

javascript - 从头开始水平视差滚动 - 无插件 (jQuery)

javascript - 如何使用 js setinterval() 在两种背景颜色之间切换