繁体   English   中英

通过使用#hash / anchor(而非数字)显示jQuery循环幻灯片

[英]Show jQuery cycle slide by using #hash/anchor, not numbers

我正在一个页面布局网站上工作,在这里我使用jQuery Cycle在内容之间切换。

目前,我已经更改了脚本,因此它可以在URL中显示当前幻灯片(以便可以收藏当前幻灯片)。

我还可以对正确的ID发出警报,但无法激活滑动功能/效果。

$(window).bind('hashchange', function () { //detect hash change
        var hash = window.location.hash.slice(1); //hash to string (= "myanchor")
        alert(hash); //This Alerts the right ID/anchor of the current slide
        //$('.slideshow').cycle(hash); // This doesn't work. If I use 1, 2, 3 etc. it shows the diffent slides
    });

我该如何工作? 我想念什么吗?

先感谢您。

我尚未完成此操作,但即将尝试以下解决方案: http : //wesbos.com/jquery-cycle-link-within-hashchange/

编辑:就像一个魅力!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM