开发者

Resolve conflicting jquery plugins: quicksand and lavalamp

I have a problem with jQuery Quicksand and jQuery Lavalamp plugins.

It seems they conflict and don't work together. I wonder why and开发者_高级运维 how can I solve this?

I'm using jQuery 1.4.2


A jQuery Ex is like this

<script type="text/javascript">
    $(document).ready(function() {
    $("ul.dropdown-horizontal ul li:has(ul)").addClass("dir");
    });

    $(function() {
    $('#slideshow').cycle({
    fx:      'scrollDown',
    timeout:  5000,
    pause:   1,
    speedIn:  2000,
    speedOut: 500,
    easeIn:  'bounceout',
    easeOut: 'backin',
    delay:   -2000
    });
    });
    </script>

This code running perfect, if there are no other jQuery code. But it will be got an error if you has another jQuery code. So to handle this problem, you need to has a unique variable. I mean mostly $ (variables) is the default code of jQuery, so we must to create unique variable

This is an example of the code after I make unique variables,

<script type="text/javascript">
var $jx = jQuery.noConflict();

$jx(document).ready(function() {
$jx("ul.dropdown-horizontal ul li:has(ul)").addClass("dir");
});

$jx(function() {
$jx('#slideshow').cycle({
fx:      'scrollDown',
timeout:  5000,
pause:   1,
speedIn:  2000,
speedOut: 500,
easeIn:  'bounceout',
easeOut: 'backin',
delay:   -2000
});
});
</script>

When you check the second code, you will found a unique variable $jx as a new variable and replace default $.

Refer : http://docs.jquery.com/Using_jQuery_with_Other_Libraries


There was a problem with jQuery Easing plugin. It was included 2 times.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜