Bootstrap:Carousel图像没有移动

时间:2015-07-01 18:46:54

标签: css html5 twitter-bootstrap css3 carousel

嘿,我正在尝试在页面上实现轮播。但我面临的问题是只有活动图像显示在屏幕上。图像甚至没有移动,即尽管文件夹中存在beign,但第二和第三图像仍未显示。 我将图像放在index.html文件所在的同一文件夹中。 请帮忙。我的代码段如下:

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

  <!-- Wrapper for slides -->
  <div class="carousel-inner">

    <div class="item active">
      <img src="slide_1.jpg" alt="Sale 1" class="img-responsive">
      <div class="carousel-caption">
        <!-- caption here -->
      </div>
    </div>

    <div class="item">
      <img src="slide_2.jpg" alt="Sale 2" class="img-responsive">
      <div class="carousel-caption">
      <!-- caption here -->
      </div>
    </div>

  </div>

  <!-- Controls -->
  <a class="carousel-control left" href="#myCarousel" data-slide="prev">
    <span class="icon-prev"></span>
  </a>

  <a class="carousel-control right" href="#myCarousel" role="button" data-slide="next">
    <span class="icon"></span>
   </a>

</div>
<!-- div Carousel ends here -->

2 个答案:

答案 0 :(得分:0)

您是否在头标记中包含以下脚本?

 <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
  <style>
  .carousel-inner > .item > img,
  .carousel-inner > .item > a > img {
      width: 70%;
      margin: auto;
  }
  </style>

答案 1 :(得分:0)

页面上是否有以下内容?

$( '转盘')。转盘({   间隔:2000 });

http://getbootstrap.com/javascript/#carousel-methods