如何在播放期间反转 jQuery Cycle 幻灯片中显示的图片顺序?
所以我的问题非常简单。假设我有一个带有“淡入淡出”过渡的幻灯片,总共有 10 张图片,并且我还有典型的下一张/上一张按钮。幻灯片自动从图像 1 循环到图像 10。如何让用户可以随时反转播放顺序?例如,在观看图像 6 时,用户单击“上一页”(或必要时单击新按钮),然后返回到图像 5 后,幻灯片继续播放图像 4、3、2...
这可能吗?我读到并尝试了 Cycle 中的“rev”选项,但我无法使其工作,实际上我不确定它的目的是我需要的。
谢谢您的任何想法!
So my question is pretty straight-forward. Say I have a slideshow running with 'fade' transitions with 10 pictures in total, and I have the typical next/prev buttons as well. The slideshow cycles automatically from image 1 to image 10. How can I make it possible for the user to reverse the playback order at any moment? For example, while watching image 6, the user clicks 'prev' (or a new button if necessary), and after going back to image 5, the slideshow continues with image 4, 3, 2...
Is this even possible? I read about and tried the 'rev' option in Cycle, but I couldn't make it work, and actually I'm not sure that its purpose is the one I need.
THank you for any ideas!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看源代码,看起来 rev 选项仅适用于动画,不适用于淡入淡出。以下是确切的评论:
您可能正在寻找向后:
当您想要颠倒顺序时,请尝试将其设置为 true。
编辑:可能有更好的方法来做到这一点。无论如何,这是一种方法。首先,向按钮添加一个调用某个函数的点击处理程序:
然后在循环插件 JS 文件中查找 handleArguments(cont, options, arg2) 函数。在 switch 语句中,添加一个案例:
编辑:此案例假设您正在滑动浏览所有图像。如果您使用slideExpr选项,那么这会导致问题。
请注意,这会切换方向,因此单击按钮两次会使其恢复正常,如果您只想反转方向,请将大小写更改为:
编辑:希望是最后一个。在插件 JS 文件中,搜索以下内容:
将特定选择替换为:
Looking at the source, it looks like the rev option is only for animations, which doesn't apply to fade. Here is the exact comment:
You may be looking for backwards:
Try setting that to true when you want to reverse the order.
EDIT: There is probably a better way to do this. In any case, here is one way. First, add a click handler to your button that calls some function:
Then in the cycle plugin JS file, look for the handleArguments(cont, options, arg2) function. In the switch statement, add a case:
EDIT: This case assumes that you are sliding through all your images. If you are using the slideExpr option, then this will cause problems.
Note that this toggles the direction, so clicking the button twice returns it to normal, if you only want it to reverse it, change the case to:
EDIT: Last one hopefully. In the plugin JS file, do a search for the following:
Replace that specific selection with: