再次使用 jQuery 多行轮播
我需要一个两行的滑块。在 jQuery google group 找到了解决方案。
有效,但错误。 :) 使用选项“circular: true”滚动到空白处。发布了一个示例来理解我的意思: http://test.demx.info/carousel/
如何修复它吗?
I need a slider with two rows. Found a solution in jQuery google group.
Works, but wrong. :)
With option "circular: true" scrolled into the void. Posted an example to understand what i mean: http://test.demx.info/carousel/
How do fix it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
jCarousel_Lite 中有一个错误。 这里是将 jCarousel_Lite 代码固定为纯文本,就在这里,已压缩。
如果您对问题所在感到好奇:如果用户到达轮播列表的末尾,作者会检查两个不同的条件 - 首先,当
circular
为true
时,他会像这样检查这:if (to <= o.start - v - 1)
和if (to >= itemLength - v + 1)
。第二个检查,当circular
设置为false
时,他这样检查:if (to < 0 || to > ((itemLength - v ) / o.rows))
。我所做的只是将if (to <= o.start - v - 1)
和if (to >= itemLength - v + 1)
更改为 <代码>if (to < 0) 和if (to > ((itemLength - v) / o.rows))
。它有效! =)There is a bug in jCarousel_Lite. Here is fixed jCarousel_Lite code as a plain text and here it is, zipped.
If you are curious on what was wrong: author checked for two different conditions if user reached the end of carousel' list - first, when
circular
istrue
, he checked it like this:if (to <= o.start - v - 1)
andif (to >= itemLength - v + 1)
. The second check, whencircular
is set tofalse
, he checked it like this:if (to < 0 || to > ((itemLength - v) / o.rows))
. What have i done is just changedif (to <= o.start - v - 1)
andif (to >= itemLength - v + 1)
toif (to < 0)
andif (to > ((itemLength - v) / o.rows))
. And it works! =)