我正在尝试使用jQuery的marquee插件。
但是我在FireBug console jQuery("#marquee").marquee is not a function中得到了这个错误。
我的代码是:
<script src="jquery-1.6.4.min.js" type="text/javascript"></script>
<script src="jquery.marquee.js" type="text/javascript"></script>
<script type="text/javascript">
jQuery.noConflict();
jQuery(document).ready(function (){
jQuery("#marquee").marquee();
});
</script>我的html是:
<ul id="marquee" class="marquee">
<li>Some text</li>
</ul>我正在使用这个超级插件:
http://www.givainc.com/labs/marquee_jquery_plugin.htm
有什么问题吗?
-----EDIT-----
我在一个独立的页面上测试了它,除了标记代码之外,它什么也没有,而且它成功了!
我认为我正在使用的其他库正在制造问题。
我的整个<head>是:
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="robots" content="index, follow" />
<meta name="generator" content="Joomla! 1.7 - Open Source Content Management" />
<title>title</title>
<link href="/joomla/index.php?option=com_content&view=category&layout=blog&id=89&Itemid=559&format=feed&type=rss" rel="alternate" type="application/rss+xml" title="RSS 2.0" />
<link href="/joomla/index.php?option=com_content&view=category&layout=blog&id=89&Itemid=559&format=feed&type=atom" rel="alternate" type="application/atom+xml" title="Atom 1.0" />
<link href="http://localhost/joomla/index.php?option=com_search&view=category&layout=blog&id=89&Itemid=559&format=opensearch" rel="search" title="title" type="application/opensearchdescription+xml" />
<link rel="stylesheet" href="/joomla/media/system/css/modal.css" type="text/css" />
<link rel="stylesheet" href="/joomla/plugins/content/attachments/attachments.css" type="text/css" />
<link rel="stylesheet" href="/joomla/plugins/content/attachments/attachments1.css" type="text/css" />
<link rel="stylesheet" href="media/system/css/jquery.marquee.css" type="text/css" />
<script src="/joomla/media/system/js/core.js" type="text/javascript"></script>
<script src="/joomla/media/system/js/mootools-core.js" type="text/javascript"></script>
<script src="/joomla/media/system/js/caption.js" type="text/javascript"></script>
<script src="/joomla/media/system/js/mootools-more.js" type="text/javascript"></script>
<script src="/joomla/media/system/js/modal.js" type="text/javascript"></script>
<script src="/joomla/plugins/content/attachments/attachments_refresh.js" type="text/javascript"></script>
<script src="media/system/js/jquery-1.7.1.min.js" type="text/javascript"></script>
<script src="media/system/js/jquery.marquee.js" type="text/javascript"></script>
<script type="text/javascript">
function keepAlive() { var myAjax = new Request({method: "get", url: "index.php"}).send();} window.addEvent("domready", function(){ keepAlive.periodical(840000); });
window.addEvent('domready', function() {
SqueezeBox.initialize({});
SqueezeBox.assign($$('a.modal'), {
parse: 'rel'
});
});
window.addEvent('domready', function() {
SqueezeBox.initialize({});
SqueezeBox.assign($$('a.modal-button'), {
parse: 'rel'
});
});
jQuery.noConflict();
jQuery(document).ready(function (){
jQuery("#marquee").marquee();
});
</script>
<link type="text/css" rel="stylesheet" href="http://localhost/joomla/plugins/content/jumultithumb/assets/style.css" />
<link rel="stylesheet" href="/joomla/templates/siteground-j16-25/css/template.css" type="text/css" />
<script type="text/javascript" src="/joomla/templates/siteground-j16-25/js/CreateHTML5Elements.js"></script>
<script type="text/javascript" src="/joomla/templates/siteground-j16-25/js/jquery-1.7.1.min.js"></script>
<script type="text/javascript">jQuery.noConflict();</script>
<script type="text/javascript" src="/joomla/templates/siteground-j16-25/js/sgmenu.js"></script>发布于 2012-02-07 20:51:46
看到你最新的问题,问题就很清楚了。您正在第二次加载jquery (第3行),当然,它覆盖了以前加载的所有插件。而且,由于对.marquee的调用是异步的(回调到就绪事件),所以在调用回调时插件就会消失。
解决方案:删除第二次加载jquery时的内容。
发布于 2012-02-07 20:17:46
试着把这个:
<script type="text/javascript">
jQuery.noConflict();
jQuery(document).ready(function (){
jQuery("#marquee").marquee();
});
</script>在身体里
下面是我所说的一个例子:http://jsfiddle.net/mjgasner/m64xQ/
现在,它不起作用,但是如果将javascript加载更改为now the (body),它就能工作。
https://stackoverflow.com/questions/9183042
复制相似问题