Bootstrap.js Carousel加载特定项目

Bootstrap.js Carousel load specific item

本文关键字:项目 加载 js Carousel Bootstrap      更新时间:2023-09-26

我有一个基于本教程的Bootstrap.js Carousel,它有4个视图项,每个看起来像这样-

<div class="item active"><!-- class of active since it's the first item -->
          <div class="carousel-caption">
            <p>Caption text1 here</p>
          </div>
</div>

演示——http://jsfiddle.net/urielz/yu4qE/3/

也有左右按钮,可以根据项目顺序滑动菜单上的内容。

所以我的问题是-

哪个命令(可能是任何jQuery选择器)会导致将特定的"项"加载到菜单中?

例如,使用- $('.carousel')[3].showOnMenu(...)来加载菜单上的第4项。

在carousel中使用.carousel(number)方法

$(document).ready(function(){
        $('.carousel').carousel({
          interval: 7000
        });
        $('.carousel').carousel(2);// use this here it index 0 base 
      });

更新小提琴

引用http://getbootstrap.com/javascript/旋转木马