开发者

jQuery No Conflict mode doesn't work

On my page http://all-fours.pl/ I'm using moo.fx for.. something, I don't really know what. And now I was trying to add a jquery banner rotator. But still regarding fact that I'm setting my banner script in jQuery.noConflict(), the moo.fx library gives errors :

function to set the jquery cycle plugin:

<script type="text/javascript">
jQuery.noConflict();
jQuery(document).ready(function(){
    jQuery('.banner').cycle({
        effect: 'fade'
    });开发者_如何学C
});
</script>

Now my firebug states, that "$ is not a function" in some moo.fx script. How to resolve this ?


In case anyone finds this later .noConflict() is intended to restore $ to it's previous value, if you include jQuery first that previous value is undefined. You'll need to include jQuery after what you want to restore it to in order for it to work.

The jQuery.noConflict() documentation has more details.


Solved by including jquery at the bottom of my scripts list.


Try adding the $ inside the function parameters:

<script type="text/javascript">
jQuery.noConflict();
jQuery(document).ready(function($){
    $('.banner').cycle({
        effect: 'fade'
    });
});
</script>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜