寻找同步多个 nivo-slider 的功能
我第一次在堆栈溢出上发帖,所以我希望有人能够帮助我解决这个问题:
我在一个页面上有 3 个 nivo-slider,水平排列。我希望它们能够同步,但更常见的是它们在几秒钟后就会失去同步。当所有滑块都使用此代码初始化时就是这种情况:
$(window).load(function() {
$('#slider').nivoSlider({
animSpeed:500,
pauseTime:3000,
});
});
但是,我想我可以像这样设置一个滑块,并使用参数设置另外两个滑块:
manualAdvance:true,
然后
beforeChange: function(){},
在第一个滑块上使用:来控制其他两个 - 将它们保持在同步。但是...我不确定在这里使用什么功能来转发其他滑块,我已经到处查看了,我真的很感谢您的帮助,提前致谢!
My first time posting on stack overflow so i'm hoping someone will be able to give me a hand with this problem:
I have 3 nivo-sliders on a page, lined up horizontally. I would like them to be synchronised but more often then not they fall out of sync after a few seconds. This is the case when all sliders are initialised with this code:
$(window).load(function() {
$('#slider').nivoSlider({
animSpeed:500,
pauseTime:3000,
});
});
However, I figured that I could set one slider up like this and another two with the parameter:
manualAdvance:true,
and then use:
beforeChange: function(){},
on the first slider to control the other two - keeping them in sync. However... I'm not sure what function to use here in order to forward the other sliders and I have looked EVERYWHERE, I really appreciate your help with this, thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这似乎没有在插件的核心中实现
,但您可以在 Nivo Slider v2.6 中自行添加它,
未压缩版本位于 start 和 stop 函数声明下方的第 633 行,
添加以下函数
您可以在包含更改后 。你可以使用它,就像
把它放在正确的事件中一样,你应该完成
This doesnt seem to be implemented in the core of the Plugin
but you may add it yourself
in Nivo Slider v2.6 the uncompressed version at line 633 just below the function declaration of start and stop
you may add the folowing function
after incldueing the changed .js and maybe compress it yourself (http://javascriptcompressor.com/) you may use it like
put this in the right event and you should be done
我想,设置暂停时间和 animSpeed 应该能让你的 nivo 滑块同步。
你说“更常见的是它们在几秒钟后失去同步”,是否有可能你有pauseOnHover:true并且你无意中将鼠标悬停在它们上并且它们变得不同步。可能是一个愚蠢的问题,但这发生在我身上。
Setting the pause time and animSpeed should get your nivo sliders in sync I would have thought.
You say "more often then not they fall out of sync after a few seconds", is it possible you have pauseOnHover: true and you are hovering over them inadvertantly and they are getting out of sync. May be a silly question but this has happened to me.