Twitter Bootstrap Carousel - 访问当前索引 [英] Twitter Bootstrap Carousel - access current index

查看:31
本文介绍了Twitter Bootstrap Carousel - 访问当前索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从轮播中获取当前索引?

How do I get the current index from the carousel?

在这种情况下,我使用的是无序列表.我知道我可以搜索列表项以找到具有活动"CSS 类的项,但我想知道是否可以直接询问轮播对象.

In this case I am using an unordered list. I know I could search through the list items to find the one with the 'active' CSS class, but I want to know if I can ask the carousel object directly.

附加:能够访问目标索引(在幻灯片"事件上)也很方便.同样,我可以通过搜索来做到这一点:

Additional: being able to access the target index (on 'slide' event) would be handy also. Again, I can do this by searching with:

var idx = $('.carousel-inner li.active').index();

...然后根据方向进行加/减,但我希望有更清晰的东西.

...and then adding/subtracting based on direction, but I am hoping for something cleaner.

推荐答案

不,没有办法访问索引或方向.

Nope, there is no way to access index or direction.

见这里

//编辑

Bootstrap 更改了存储库,新的 link

Bootstrap changed repos, new link

这篇关于Twitter Bootstrap Carousel - 访问当前索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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