如何获取 jCarouselLite 中的可见项目?
我正在为我的网站使用 jCarouselLite 插件。效果非常好。我想在图像底部添加一些项目符号(不仅仅是箭头)作为外部控件。因此,通过单击第二个项目符号,它将转到第二张图像。使用插件提供的 btnGo 也可以很好地工作。
我还想做的是改变项目符号,根据我每次看到的图像看起来是活跃的。因此,当我单击下一个箭头并看到第二张图像时,我希望立即激活第二个项目符号。为此,我想知道我看到的图像的数量。
我知道通过 afterEnd 回调函数我得到了动画之后处于活动状态的对象。有没有办法只获取该对象的编号?例如,如果该对象是第二张图像,则仅获取数字 2。
有人知道这方面的情况吗?
提前致谢
I am using the jCarouselLite plugin for my site. It works very nice. I wanted to add some bullets also at the bottom of the images (not only arrows) as external controls. So by clicking the second bullets it will go to the second image. This works also fine using the btnGo the plugin provides.
What I also want to do is to change the bullet, looking as active based on which image I see every time. So when I click the next arrow and I see the second image I want immediately the second bullet to be active. For doing this I want to know the number of the image I see.
I know that through the afterEnd callback function I get the object that is active after the animation. Is there a way to get just the number of this object? For example if the object is the second image, to get only the number 2.
Does anyone know something about it?
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
评论 #315 jCarousel Lite #All-Comments 给了我这个答案(我刚刚使用过):
它基本上使用字符串替换来根据即将显示的类似命名的图像来获取“活动”控件的数量。
假设您有带有 id 的外部控件:
“#pi1”、“#pi2”、“#pi3”、“#pi4”、“#pi5”、“#pi6”
以及 id 为:
“#im1”、“#im2”、“#im3”、“#im4”、“#im5”、“#im6”
在启动 jCarousel Lite 功能之前,计算 li 的数量:
添加启动前功能:
Comment #315 on jCarousel Lite #All-Comments gave me this answer (which I just used) :
It's basically using string replacements to get the number of which control is "active" based on which similarly named image is about to show.
Assuming you have external controls with ids:
“#pi1″, “#pi2″, “#pi3″, “#pi4″, “#pi5″, “#pi6″
And the images with ids of:
“#im1″, “#im2″, “#im3″, “#im4″, “#im5″, “#im6″
Before you start the jCarousel Lite function, count the number of li’s:
Add the before start function: