如何使用jCarousel Lite获取当前索引? [英] How to get the current index with jCarousel Lite?

查看:139
本文介绍了如何使用jCarousel Lite获取当前索引?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jCarousel Lite并且需要获取当前索引(显示哪个元素,因为我一次只显示一个项目)所以我可以在导航链接中添加当前类。

I'm using jCarousel Lite and need to get the current index (which element is being displayed as I'm only showing one item at a time) so I can add a "current" class to the navigation link.

有人知道如何做到这一点吗?

Does anybody know how I can accomplish this?

http://www.gmarwaha.com/jquery/jcarousellite

推荐答案

从您发布的链接文档


afterEnd 动画结束后应调用
的回调函数。
表示动画
结束后可见的
项的元素作为参数传入。

afterEnd Callback function that should be invoked after the animation ends. The elements representing the items that are visible after the animation ends are passed in as argument.

因此,创建一个设置当前类的函数,并在创建轮播时将其作为 afterEnd 选项传递。

So, create a function that sets your "current" class, and pass it as the afterEnd option when you create the carousel.

这篇关于如何使用jCarousel Lite获取当前索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆