jQuery Cycle 插件不生成寻呼机链接

发布于 2024-09-25 20:56:18 字数 766 浏览 1 评论 0原文

在我最近工作过的几个网站上,这个问题一直让我感到困惑,我最终不得不采用另一种解决方案,但这次我决心彻底弄清楚它。

以下是演示页面中的示例代码: http://jquery.malsup.com/cycle/ int2.html

$('#s4') 
.before('<div id="nav">') 
.cycle({ 
    fx:     'turnDown', 
    speed:  'fast', 
    timeout: 0, 
    pager:  '#nav' 
});

这是我相当相似的代码片段:

$(document).ready(function() {
    $("#banners").before('<div id="banner-nav" class="nav"/>').cycle({
        fx: 'fade',
        speed: 1000,
        pager: '.nav'
    });
});

导航 div 是作为正常的 jQuery 调用正确生成的,但其中没有任何内容,是空的。这不是 CSS 问题,因为根本没有生成标记,我已更改为不同版本的 jQuery 1.3.x - 1.4.x,我已将容器元素更改为除 div、ul 等之外的其他元素,并且我已将其从 document.ready 调用中删除,但仍然没有运气。

This one has been perplexing me on a couple recent sites I've worked on, and I had to end up going with another solution, but I'm determined to get to the bottom of it this time.

Here is the example code from the demo page here: http://jquery.malsup.com/cycle/int2.html

$('#s4') 
.before('<div id="nav">') 
.cycle({ 
    fx:     'turnDown', 
    speed:  'fast', 
    timeout: 0, 
    pager:  '#nav' 
});

And here is my fairly similar snippet:

$(document).ready(function() {
    $("#banners").before('<div id="banner-nav" class="nav"/>').cycle({
        fx: 'fade',
        speed: 1000,
        pager: '.nav'
    });
});

The nav div is generated correctly as a normal jQuery call, but there is nothing in it, empty. It's not a CSS issue, because there is no markup generated at all, I've changed to different versions of jQuery 1.3.x - 1.4.x, I've changed the container element to something else besides a div, ul etc, and I've removed it from the document.ready call, and still no luck.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

夜血缘 2024-10-02 20:56:18

问题解决了,太愚蠢了,请确保您使用的是 jquery.cycle.ALL 而不是任何其他较轻的版本,因为它们不支持分页功能。我的阅读理解不及格。

Problem solved, so stupid, make sure you're using jquery.cycle.ALL and not any of the other lighter versions as they don't have support for the paging feature. Reading comprehension fail on my part.

初相遇 2024-10-02 20:56:18

即使示例如此说明,他们在网络中使用的代码是:

$('#s4').before('<div id="nav" class="nav">').cycle({
    fx:     'turnDown',
    speed:  'fast',
    timeout: 0,
    pager:  '#nav'
});

我认为问题可能是在寻呼机参数中使用类而不是 id,请尝试在您的代码中使用 #banner-nav代码并看看是否有效。

Even when the example says so the code they are using in their web is:

$('#s4').before('<div id="nav" class="nav">').cycle({
    fx:     'turnDown',
    speed:  'fast',
    timeout: 0,
    pager:  '#nav'
});

And I think the problem is probably using a class instead of an id in the pager parameter, try with #banner-nav in your code and see if that works or not.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文