【问题标题】:How to tell Bootstrap Carousel to go to a specific index?如何告诉 Bootstrap Carousel 转到特定索引?
【发布时间】:2012-04-16 10:06:02
【问题描述】:

我在一个项目中使用 Bootstrap 和 Bootstrap Carousel。

我想知道是否有任何方法可以让轮播导航到特定幻灯片。
例如,类似:

$('myCarousel').to(2);

有人知道怎么做吗?

【问题讨论】:

    标签: javascript jquery twitter-bootstrap carousel


    【解决方案1】:

    来自文档:

    .carousel(number) 将轮播循环到特定帧(从 0 开始, 类似于数组)。

    所以我认为应该是:

     $('myCarousel').carousel(2);
    

    【讨论】:

      【解决方案2】:

      使用 jQuery 选择轮播的元素并使用 .carousel() 方法:

      $("#myCarousel").carousel(2);
      

      这会将您带到第三张幻灯片。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2013-01-16
        • 1970-01-01
        • 2019-06-13
        • 2012-04-09
        • 2011-07-13
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多