jQuery 循环不工作/表现得很有趣
我正在开发 http://www.aceaofmidland.com/ 并且我正在尝试使用 jQuery 和jQuery.cycle 循环遍历 WordPress 自定义帖子类型,其标记如下:
<div id="toolbar">
<div id="home">
<div id="arrows">
<div class="prev"></div>
<div class="next"></div>
</div>
<div id="descriptions">
<div><strong>Second Home Alert Test</strong><br><p>Testing Testing Testing</p></div>
<div><strong>Test Home Alert Title</strong><br><p>Test Content for homepage alert</p></div>
</div>
</div>
</div>
我正在使用以下 jQuery 来尝试激活循环。我确信我已正确加载脚本,并且也按顺序加载。
<script type="text/javascript">
jQuery.noConflict();
jQuery(function(){
jQuery('#descriptions').cycle({
next: '.next',
prev: '.prev',
fx: 'fade',
speed: 'fast',
timeout: 5000,
pause: 1
});
});
</script>
如果有人能找出如何让它发挥作用,我将永远感激不已。谢谢你!
I'm working on http://www.aceaofmidland.com/ and I'm trying to use jQuery and jQuery.cycle to cycle through a wordpress custom post type that's marked up like so:
<div id="toolbar">
<div id="home">
<div id="arrows">
<div class="prev"></div>
<div class="next"></div>
</div>
<div id="descriptions">
<div><strong>Second Home Alert Test</strong><br><p>Testing Testing Testing</p></div>
<div><strong>Test Home Alert Title</strong><br><p>Test Content for homepage alert</p></div>
</div>
</div>
</div>
I'm using the following jQuery to try and activate the cycling. I'm positive I have the scripts correctly loaded, and in order too.
<script type="text/javascript">
jQuery.noConflict();
jQuery(function(){
jQuery('#descriptions').cycle({
next: '.next',
prev: '.prev',
fx: 'fade',
speed: 'fast',
timeout: 5000,
pause: 1
});
});
</script>
If anyone can find out how to get this to work, I'll be forever grateful. Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 firebug 中,我在页面加载时遇到以下错误:
并且
您可能需要更改此行:
到
https://developer.mozilla.org/en/JavaScript/Reference/Operators/Special/typeof
并且 jQuery 代码可能应该包装在
$(document).ready(function () {});
包装器。在更改有问题的代码本身之前,我总是会尝试解决在我正在排除故障的代码之前发生的所有错误。
In firebug I get the following errors on pageload:
and
You may want to change this line:
to
https://developer.mozilla.org/en/JavaScript/Reference/Operators/Special/typeof
And that jQuery code should probably be wrapped in a
$(document).ready(function () {});
wrapper.I would always try to resolve all errors that occur before the code I am troubleshooting before altering the problematic code itself.