Twitter Bootstrap Carousel按钮不起作用

时间:2015-04-22 12:26:42

标签: javascript jquery html twitter-bootstrap twitter-bootstrap-3

我试图将bootstrap 3 carousel实现到我的网站中,但左右滑动按钮不起作用,滑动点也是如此。有人能在我的代码中发现问题吗?

<!doctype html> 
<html>
<head>
    <script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
    <script type="text/javascript" scr="js/bootstrap.js"></script>
    <link rel="stylesheet" type="text/css" href="css/bootstrap.css">
    <title>Test page! </title>
</head>


<body>
<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>
  </ol>

  <!-- Wrapper for slides -->
  <div class="carousel-inner" role="listbox">
    <div class="item active">
      <img src="img/deepcleaning1.jpg" alt="deepcleaning">
    </div>
    <div class="item">
      <img src="img/deepcleaning2.jpg" alt="deepcleaning2">
    </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>

</body>
</html>

2 个答案:

答案 0 :(得分:0)

听起来与Bootstrap Carousel does not work

类似的问题

答案建议检查javascript错误,尤其是jquery的链接。似乎在URL中添加http或https可以解决问题。

<script src="http://code.jquery.com/jquery-1.11.2.min.js"></script>

<script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>

答案 1 :(得分:0)

由于某种原因,jquery链接无法正常工作...我所做的只是下载jquery文件并链接到它而不是使用API​​。像魅力一样。

不知道为什么链接对我不起作用...