新的Bootstrap Carousel需要帮助

时间:2013-08-10 16:06:44

标签: css twitter-bootstrap

我有以下代码,我已经链接到jQuery等。但是,当我点击移动轮播时,它会做同样的事情:

<a href="#"></a>

确实

任何人都可以帮我修复我的代码!提前谢谢!

<div id="carousel-example-generic" class="carousel slide">
  <!-- Indicators -->
  <ol class="carousel-indicators">
    <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
    <li data-target="#carousel-example-generic" data-slide-to="1"></li>
    <li data-target="#carousel-example-generic" data-slide-to="2"></li>
  </ol>

  <!-- Wrapper for slides -->
  <div class="carousel-inner">
    <div class="item active">
      <img src="img/slide1.jpg" alt="" width="100%" height="50%">
      <div class="carousel-caption">
        Test1
      </div>
    </div>
    <div class="item">
      <img src="img/slide1.jpg" alt="" width="100%" height="50%">
      <div class="carousel-caption">
        Test2
      </div>
    </div>
    ...
  </div>

  <!-- Controls -->
  <a class="left carousel-control" href="#carousel-example-generic" data-slide="prev">
    <span class="icon-prev"></span>
  </a>
  <a class="right carousel-control" href="#carousel-example-generic" data-slide="next">
    <span class="icon-next"></span>
  </a>
</div>

<div id="wrapper">





</div>


<script type="text/javascript">$('.carousel').carousel()</script>
<script type="text/javascript" src="http://code.jquery.com/jquery-2.0.3.min.js"></script>

1 个答案:

答案 0 :(得分:2)

初始化jQuery库后,需要为carousel添加脚本标记。

<script type="text/javascript" src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
<script type="text/javascript">$('.carousel').carousel()</script>