开发者

Multiple jQuery Instances and jQuery plugins generate Errors

开发者 https://www.devze.com 2023-03-27 02:14 出处:网络
I am using two jQuery plugins in my site color box popup plugin and coda content slider 1- http://colorpowered.com/colorbox/

I am using two jQuery plugins in my site color box popup plugin and coda content slider

1- http://colorpowered.com/colorbox/

2- http://www.ndoherty.biz/demos/coda-slider/2.0/

It seems that both conflict with each other. I have added the required JS file in this order

<!-- 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>

Independently both plugins work fine. But when used together I get different errors in Firebug. This is the error I am get开发者_JS百科ting right now

jQuery.easing[jQuery.easing.def] is not a function
[Break On This Error] return jQuery.easing[jQuery.easing.def](x, t, b, c, d); 

These plugins definitely conflict each other. Is there any solution to this ? Can use multiple jQuery instances?


The coda slider plugin is a bit old (jQuery 1.3.2), with an external jquery.easing.js that...well, frankly screws up more recent jQuery versions.

I think by far the easiest solution here is to go with another plugin for your coda slider effect, there are several options out there, for example: http://jqueryfordesigners.com/coda-slider-effect/ (demo here)

...or, if you're not tied to that effect specifically, there are lots of other sliders out there.


OK I have solved my problem , I just moved <?php wp_head(); ?> at start of <head> tag in in Wordpress header.php and it worked .. strange but it worked for me :)

0

精彩评论

暂无评论...
验证码 换一张
取 消