jQuery 循环 +最小超时
我在 jQuery 循环插件及其超时方面遇到了一个小问题。
我正在使用 scrollLeft
效果,并希望让它始终保持滚动(类似于新闻收报机,如果您知道我的意思的话)。现在使用 timeout: 0
将不起作用,因为它会完全禁用自动滚动。
所以我想到使用 timeout: 10
(有一个几乎不明显的超时),但这也不起作用,因为无论我将超时设置得多低,超时似乎总是大约一秒(即使使用超时:1
)。
再次使它更清楚一点:
将超时增加到 timeout: 10000
可以达到预期的效果并暂停滑动 10 秒,但将其减少到 timeout: 1
看起来就像我使用 timeout: 1000
一样,
我不确定问题出在哪里,因为我在 Google 上到处寻找最小超时,但找不到任何说明超时最小值为 1000
我使用的脚本非常简单,所以我认为那里应该没有错误,但只是为了让您也可以检查我发布它:
$('#demo').cycle({
slideExpr: 'p',
fx: 'scrollLeft',
next: '.next',
speedIn: 5000,
speedOut: 5000,
fastOnEvent: 1000,
containerResize: 0,
pause: 1,
timeout: 10
});
我希望我能够解释我的问题很好:)
问候!
ps 我不想使用某种 newsticker 插件,但真的很想用循环创建这种效果。
I am having a small problem with the jQuery cycle plugin and its timeout.
I am using the scrollLeft
effect and would like to get it to always keep scrolling (similar to a news ticker if you know what I mean). Now using timeout: 0
will not work, because it would disable the auto scolling at all.
So I thought of using timeout: 10
(to have a almost non noticeable timeout), but this doesnt work too, because no matter how low I set the timeout, the timeout always seems to be about a second (even when using timeout: 1
).
Again to make it a bit more clear:
Increasing the timeout to timeout: 10000
has the desired effect and pauses the sliding for 10 seconds, but decreasing it to timeout: 1
looks just like as if I used timeout: 1000
I am not sure where the problem is, because I was looking all around Google for minimum timeout, but couldnt find anything that said the timeout minimum is 1000
The script I am using is very simple, so I think there should be no errors there, but just so that you can check that too I post it:
$('#demo').cycle({
slideExpr: 'p',
fx: 'scrollLeft',
next: '.next',
speedIn: 5000,
speedOut: 5000,
fastOnEvent: 1000,
containerResize: 0,
pause: 1,
timeout: 10
});
I hope I was able to explain my question well enough :)
Regards!
p.s. I dont want to use some sort of newsticker plugin, but would really like to create that effect with cycle.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您需要真正连续的滚动,可以使用
easeIn
和easyOut
选项。试试这个:If you need a really continuous scroll, you can use the
easeIn
andeasyOut
options. Try this:jQuery Cycle 有一个名为 连续 的选项,这是该插件能够实现的最接近的选项到传统的新闻行情。尝试以下操作:
我希望这会有所帮助!
There is an option for jQuery Cycle called continuous which is the closest the plugin is able to come to a traditional news-ticker. Try the following:
I hope this helps!
编辑:忽略这个答案,因为它需要更改代码。使用上面回答的
连续
选项。在 buildOptions() 函数中找到以下代码
并注释 while 循环
Edit: Ignore this answer since it requires code change. Use
continuous
option as answered above.In the buildOptions() function find the following code
and comment the while loop