jQuery 幻灯片:加载暂停,从链接问题开始

发布于 2024-12-20 13:36:45 字数 549 浏览 2 评论 0原文

我见过与我类似的问题,但不完全是。 我的页面上运行着多个循环幻灯片,因此我不希望它们同时开始。 我想暂停加载它们,然后在单击一个简单的链接时启动。这是我的想法:

$('#s2').cycle({
    fx: 'scrollLeft',
    speed: 2000,
    pause:  1,
    pager:  '#speakerTwoNav',
    pagerAnchorBuilder: function(idx, el) {
        return '<a href="#"></a>';
    }
}).cycle('pause');
    $('#speakerInfoChipKiddLink').click(function(){
    $('#s2').cycle('resume');
});

这是其中一张幻灯片的示例。 #s2 是它的名称,#speakerInfoChipKidd 是我想要开始幻灯片放映的链接的 ID。

我没有收到此代码的错误,它只是没有立即暂停它。

I've seen similar problems to mine, but not exactly.
My page has multiple cycle slideshows running on it, so I don't want them to all start at once.
I'd like to load them paused, then start when clicking a simple link. Here's what I've come up with:

$('#s2').cycle({
    fx: 'scrollLeft',
    speed: 2000,
    pause:  1,
    pager:  '#speakerTwoNav',
    pagerAnchorBuilder: function(idx, el) {
        return '<a href="#"></a>';
    }
}).cycle('pause');
    $('#speakerInfoChipKiddLink').click(function(){
    $('#s2').cycle('resume');
});

This is an example of one of the slideshows. #s2 is the name of it, and #speakerInfoChipKidd is the id of the link I want to start the slideshow.

I'm not getting errors with this code, it's just not pausing it right away.

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

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

发布评论

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

评论(1

缱绻入梦 2024-12-27 13:36:45

将初始化和暂停分开:

$('#s2').cycle({
    fx: 'scrollLeft',
    speed: 2000,
    pause:  1,
    pager:  '#speakerTwoNav',
    pagerAnchorBuilder: function(idx, el) {
        return '<a href="#"></a>';
    }
});

$('#s2').cycle('pause');

Separate out the initialise and the pause :

$('#s2').cycle({
    fx: 'scrollLeft',
    speed: 2000,
    pause:  1,
    pager:  '#speakerTwoNav',
    pagerAnchorBuilder: function(idx, el) {
        return '<a href="#"></a>';
    }
});

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