jQuery jCarousel - 外部控件突出显示(换行:圆形)+随机幻灯片
我在实现 jQuery 的 jCarousel 插件时遇到了一些问题。 我正在使用的代码可在 http://projects.klavina.com/stackoverflow /index-slider.html
问题1: 我需要突出显示滑块 #1 上的活动外部控件。我在 http://heidzir.com/blog/?p=21 找到了解决方案,但正如评论中已经指出的那样 - 当滑块进入第二个循环时,它会停止工作。
问题2: 我需要在页面加载时随机化滑块#2(引号)上的幻灯片。我找到了一种随机化 li 的方法(随机化 div 元素序列jQuery),但滑块停止工作并仅滑动首先加载的报价。
任何帮助将不胜感激。谢谢你!
I've been having some problems with implementing the jCarousel plugin for jQuery.
The code I'm using is available at http://projects.klavina.com/stackoverflow/index-slider.html
Problem 1:
I need to highlight the active external control on slider #1. I found a solution at http://heidzir.com/blog/?p=21, but as already stated in the comments there - this stops working when the slider goes in the 2nd loop.
Problem 2:
I need to randomize the slides on slider #2 (quotes) on page load. I found a way to randomize the li's (Randomize a sequence of div elements with jQuery), but the slider stops working and slides only the quote that was loaded first.
Any help would be much appreciated. Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将 teasersize 设置为您拥有的列表项的数量
set the teasersize to the number of list items you have
我遇到了问题#1,并找到了一个我想分享的解决方案。循环 jcarousels 的问题在于,“liindex”在遍历所有可用列表元素后不会从 1 开始计数,而是继续向上计数(如果您添加一个alert('liindex'),您会注意到这一点) 因此,如果您在
圆形自动轮播中有 3 个列表元素,那么一旦您完成第一次滚动并从第 1 项开始,jcarousel 就会在第 4 项而不是第 1 项处看到它
。关于这个),使用总项目和当前项目的模来计算 liindex,
这就是基于 js 的外部导航应该是什么样子的:
I had problem #1 and found a solution which I'd like to share. The problem with circular jcarousels is that the "liindex" doesn't start over with counting from 1 after it ran through all available list elements, but rather continues counting upwards (as you'll notice if you add an alert('liindex') inside the highlight function.
So if you have 3 list elements in a circular auto carousel, once you finish scrolling through the first time and start over with item 1, jcarousel sees it at the 4th item, not the 1st.
Here's my solution (based on this), calculating the liindex with the modular of the total items and the current item.
And this is what your external navigation should look like based on the js: