jQuery Cycle:在最后一张幻灯片之后滚动回到第一张幻灯片
我有一个如下所示的滑块:
$('#slider').cycle({
fx: 'scrollHorz',
speed: 1250,
timeout: 5000,
easing: 'easeInOutExpo',
pager: '#slider-pagination',
next: '#next-slide',
prev: '#prev-slide',
pause: 1
});
默认情况下,当它在最后一张幻灯片上时,循环会再次向左滚动以重新开始,就好像它是一个无限循环一样。我希望它向后滚动所有幻灯片并再次落在第一张幻灯片上。就像这里的情况一样(参见最后一张幻灯片):http://www.iconlicious.com/。我必须使用 Cycle,所以我不能使用与它们相同的插件。
如何才能做到这一点?
谢谢
I have a slider that looks like this:
$('#slider').cycle({
fx: 'scrollHorz',
speed: 1250,
timeout: 5000,
easing: 'easeInOutExpo',
pager: '#slider-pagination',
next: '#next-slide',
prev: '#prev-slide',
pause: 1
});
By default, when it's on the last slide Cycle just scrolls to the left again to start over, as though it's an infinite loop. I want it to scroll back through all the slides and land on the first one again. Much like it does here (see the last slide): http://www.iconlicious.com/. I must use Cycle, so I can't use the same plugin as they are.
How can that be achieved?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
解决方案是将
nowrap
选项设置为 false。虽然我无法测试任何内容,但您可能必须使用
end
选项来定义一个函数以返回到开头。所以,像这样:
The solution is to set the
nowrap
option to false.While I can't test anything, you probably will have to use the
end
option to define a function to return to the beginning.So, something like:
使用未记录的“反弹”选项:
希望这有帮助
Use the not documented 'bounce' option:
Hope this helps
看看你的网站,我可以告诉你已经解决了你的问题,但我想发布这个以防其他人可能会发现它有价值。
您使用了
jquery.scrollable
,这是一个很棒的解决方案并为我解决了同样的问题。Looking at your website, I can tell you already solved your problem, but I wanted to post this in case there were others who might find it valuable.
You used
jquery.scrollable
, which is a great solution and solved the same issue for me.