JQuery循环同步
我在下面通过 JQuery 循环定义了两个幻灯片:
$('#slideShow').cycle({
fx: 'fade',
timeout: 3000,
speed: 2000,
random: 1
});
$('#slideText').cycle({
fx: 'blindZ',
timeout: 3000,
speed: 2000,
random: 1
});
我已经手动验证并且它们是同步的。实际上这只是运气,或者我需要定义如下内容以确保它们同步:
- 将超时参数设置为 0 循环以确保它不会自动更新。
- 使用 setInterval 函数以相同的间隔触发每个周期。
感谢您的热情帮助。
I have defined two slideshow by JQuery cycle below:
$('#slideShow').cycle({
fx: 'fade',
timeout: 3000,
speed: 2000,
random: 1
});
$('#slideText').cycle({
fx: 'blindZ',
timeout: 3000,
speed: 2000,
random: 1
});
I have validated manually and they are in sync. Actually is that just luck or I need to define something like below to ensure they are in sync:
- set timeout parameter as 0 in cycle to ensure it will not auto update.
- use setInterval function with same interval to trigger each cycle.
Thanks for your kind assistance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只要您依次开始播放两张幻灯片,就应该没问题。由于它们具有相同的超时并且一起启动,因此它们应该保持同步。
否则你可以做这样的事情;
第二张幻灯片被停用,第一张幻灯片在每次更改后发送“下一个”命令。
As long as you start your two slideshows one after another, it should be ok. Since they have the same timeouts and are started together, they should stay in sync.
Otherwise you could do something like this ;
The second slideshow is deactivated, and the first one sends a 'next' command after each change.