使用Bootstrap并使用Carousel

时间:2015-10-08 03:38:51

标签: html css twitter-bootstrap

我正在使用Bootstrap,我正在使用Carousel来显示一些图片。我已经完成了所有这些并且第一张照片显示了,但是当你点击左右雪佛龙时,它并没有带你到下一张照片。

我对HTML / CSSl有点新,而且肯定是Bootstrap。任何帮助表示赞赏。

感谢。我的轮播代码如下。



 <div class="container-fluid">
      <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
      <!-- 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" role="listbox">
    <div class="item active">
      <img src="img/type.jpg" alt="typewriter">
      <div class="carousel-caption">
        <h3>The Header</h3>
        <p>Header Text</p>
      </div>
    </div>
    <div class="item">
      <img src="img/pad.jpg" alt="scratchpad">
      <div class="carousel-caption">
        <h3>Second Header</h3>
        <p>Second Text</p>
      </div>
    </div>
    <div class="item">
      <img src="img/screen.jpg" alt="monitor">
      <div class="carousel-caption">
        <h3>Third Header</h3>
        <p>Third Text</p>
      </div>
    </div>
  </div>

  <!-- Controls -->
  <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
    <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
    <span class="sr-only">Previous</span>
  </a>
  <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
    <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
    <span class="sr-only">Next</span>
  </a>
</div>
    </div>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:1)

您可能忘记了bootstrap js文件。你也可以加入你的标题吗?

确保您在html标题中有bootstrap js(以及css)的链接

来自bootstrap site

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">

<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>