开发者

jQuery is not a function

I am trying to install a simple news ticker jQuery plugin to the home page of a website built using Joomla 1.5

No matter what I do, I always get the error jQuery("#js-news").ticker is not a function despite the files are loaded correctly and the $ sign is replaced with jQuery to avoid conflicts with Mootools.

I also tried to use the Cycle plugin first, but I was getting the same 开发者_高级运维error. The weird thing is I am using the jQuery library (1.6.2) without any problem.

link here

Any suggestion?

Thanks


I would try to wrap it in a document.ready() as well - defining jQuery last is perfect but remember to call noConflict(). Consider the following :

$j = jQuery.noConflict();

$j(document).ready(function(){
    $j('#js-news').ticker();
});

Or alternatively - Thanks @Kevin B

$j = jQuery.noConflict();

$j(document).ready(function($){
    $('#js-news').ticker();
});


Try adding this to your first line of code:

jQuery.noConflict();


It looks to me as if you need to use $.noConflict(); ( http://api.jquery.com/jQuery.noConflict/ )

I get the error with the jQuery or $ on your page, unless I execute the noConflict method. It seems the ticker plugin is not executing because of the mootools conflict.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜