jQuery Cycle - #next #prev,在 currentGallery 的最后一张幻灯片后转到 nextGallery
我在几个画廊中使用 jQuery 循环,并带有 #next #prev 导航和图像计数器输出。
现在我正试图将所有这些画廊连接在一起。如果用户到达画廊 A (galleryA.html) 的最后一张幻灯片,#next 锚点应指向画廊 B (galleryB.html)/#prev 锚点应指向画廊 C (galleryC.html)。
我怎样才能结合我的两个功能来做到这一点?
// slideshow fx $(function() { $('#slideshow').cycle({ fx: 'fade', speed: 350, prev: '#prev', next: '#next', timeout: 0, after: onAfter }); }); //image counter output function onAfter(curr,next,opts) { var caption = (opts.currSlide + 1) + opts.slideCount; $('#counter').html(caption); }
html:
<div id="slideshow-container">
<div class="slideshow-nav"><a id="prev" href=""></a></div>
<div class="slideshow-nav"><a id="next" href=""></a></div>
<div id="slideshow" class="pics">
<img src="galleryA/01.jpg" />
<img src="galleryA/02.jpg" />
<img src="galleryA/03.jpg" />
<img src="galleryA/04.jpg" />
<img src="galleryA/05.jpg" />
<img src="galleryA/06.jpg" />
</div>
</div>
I am using jQuery cycle in several galleries with #next #prev navigation and a image counter output.
Now I am trying to connect all these galleries together. If the user reaches the final slide of gallery A (galleryA.html), the #next anchor should point to gallery B (galleryB.html) / the #prev anchor should point to gallery C (galleryC.html).
How can I combine my 2 functions to do that?
// slideshow fx $(function() { $('#slideshow').cycle({ fx: 'fade', speed: 350, prev: '#prev', next: '#next', timeout: 0, after: onAfter }); }); //image counter output function onAfter(curr,next,opts) { var caption = (opts.currSlide + 1) + opts.slideCount; $('#counter').html(caption); }
html:
<div id="slideshow-container">
<div class="slideshow-nav"><a id="prev" href=""></a></div>
<div class="slideshow-nav"><a id="next" href=""></a></div>
<div id="slideshow" class="pics">
<img src="galleryA/01.jpg" />
<img src="galleryA/02.jpg" />
<img src="galleryA/03.jpg" />
<img src="galleryA/04.jpg" />
<img src="galleryA/05.jpg" />
<img src="galleryA/06.jpg" />
</div>
</div>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对cycle插件不太熟悉,但是你可以在
function onAfter
中放置类似的东西:或者你可以尝试
Untested,类似的东西?
基本上,它仅在显示最后一张幻灯片后将重定向行为附加到
#next
上。可能有一个onFinish
选项或其他选项,您检查过文档吗?Not too familiar with the cycle plugin, but you could put something like this in
function onAfter
:or you could try
Untested, something along those lines?
Basically it only attaches the redirect behaviour onto
#next
after the last slide has been shown.. There might be anonFinish
option or something, have you checked the docs?您可以在这里查看:
http://helpdesk.toitl.com/?p=cycle_plugin
在同一页面中集成 2 个同步周期并不是那么容易...在此示例中,没有使用 location=... 重新加载页面,但是这 2 个画廊是使用周期插件的不同命令进行管理的。
问候,
多米尼克·文森特
You can have a look here :
http://helpdesk.toitl.com/?p=cycle_plugin
It is not so easy to integrate 2 synchronized cycles in the same page ... In this sample there is no reload of the page with location=... but the 2 galleries are managed using the different commands of the cycle plugin.
Regards,
Dominique VINCENT