jQuery Cycle 多幻灯片和独立键盘导航

发布于 2024-08-29 00:37:23 字数 384 浏览 3 评论 0原文

我有一个包含 2 个(或更多)jQuery 选项卡的页面。每个选项卡都包含一个 jQuery Cycle 幻灯片,并在代码中附加了上一页/下一页分页。

我根据 jqueryfordesigners dot com 上的教程添加了幻灯片的键盘导航。

键盘导航适用于每个幻灯片,但幻灯片页面是同步的,即,如果分页到选项卡 1 中的第三张幻灯片,则在查看选项卡 2 时,它也会显示第三张幻灯片。

有什么办法让他们独立分页吗?

请参阅 http://pastie.org/916682

编辑:单击上一个/下一个时独立的幻灯片页面,但不与 kbd 导航。

I have a page with 2 (or more) jQuery tabs. Each tab contains a jQuery Cycle slideshow with prev/next paging appended in the code.

I've added keyboard navigation of the slideshows, based on a tutorial at jqueryfordesigners dot com.

Keyboard nav works for each slideshow but the slides page in synchrony, i.e. if paging to the 3rd slide in tab 1, when tab 2 is viewed it is showing it's 3rd too.

Any way to make them page independently?

See http://pastie.org/916682

Edit: the slideshows page independently when clicking prev/next, but not with kbd nav.

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

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

发布评论

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

评论(1

水染的天色ゝ 2024-09-05 00:37:23

已解决。我错过了显而易见的事情:活动选项卡和非活动选项卡之间的主要区别是可见性,因此只需将 :visible 添加到倒数第二个选择器(对于选项卡 div)即可。

$(document.documentElement).keyup(function(event) {
    var direction = null;
    if (event.keyCode == 37) {
        direction = 'prev';
    } else if (event.keyCode == 39) {
        direction = 'next';
    }
    if (direction != null) {
        $('#content > div:visible').each(function(index) {
            $('#prev-slide,#next-slide', this)[direction]().click();
        });
    }
});

Solved. I'd been missing the obvious: the major difference between the active and inactive tabs is visibility, so adding :visible to the penultimate selector (for the tab divs) is all it took.

$(document.documentElement).keyup(function(event) {
    var direction = null;
    if (event.keyCode == 37) {
        direction = 'prev';
    } else if (event.keyCode == 39) {
        direction = 'next';
    }
    if (direction != null) {
        $('#content > div:visible').each(function(index) {
            $('#prev-slide,#next-slide', this)[direction]().click();
        });
    }
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文