Bootstrap carousel next和prev功能不起作用,只显示第一张图片

时间:2017-03-08 15:39:38

标签: javascript jquery css twitter-bootstrap

轮播仅显示第一张图片。它不会从一张图片滑到另一张图片。 这是我的代码:

<body>
</nav>
<div id="carousel1" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
  <li data-target="#carousel1" data-slide-to="0" class="active"></li>
  <li data-target="#carousel1" data-slide-to="1"></li>
  <li data-target="#carousel1" data-slide-to="2"></li>
</ol>
<div class="carousel-inner" role="listbox">
  <div class="item active"><img src="../Images/BhutanBoys.png"  

  alt="First slide image" class="center-block">
    <div class="carousel-caption">
      <h3>First slide Heading</h3>
      <p>First slide Caption</p>
    </div>
  </div>
  <div class="item"><img src="../Images/Bhutan.png" alt="Second slide 

  image" class="center-block">
    <div class="carousel-caption">
      <h3>Second slide Heading</h3>
      <p>Second slide Caption</p>
    </div>
  </div>
  <div class="item"><img src="../Images/bicycleboy.png" alt="Third slide 

  image" class="center-block">
    <div class="carousel-caption">
      <h3>Third slide Heading</h3>
      <p>Third slide Caption</p>
    </div>
  </div>
  </div>
  <a class="left carousel-control" href="#carousel1" 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="#carousel1" role="button" 

  data-slide="next"><span class="glyphicon glyphicon-chevron-right" 

  aria-hidden="true"></span><span class="sr-only">Next</span></a></div>
</div>

<script src="js/jquery-1.11.3.min.js"></script>
<script src="js/bootstrap.js"></script>
</body>
</html>

我看了,我找不到这个问题多年了。我试图使用其他答案,但他们没有工作。请帮助,谢谢。

1 个答案:

答案 0 :(得分:0)

检查您的代码,好像您有未公开的<div>标签。

您是否在<head>代码中加载了引导程序Css?