我的引导转盘不工作

时间:2017-12-10 07:08:45

标签: html css twitter-bootstrap

我尝试了自举旋转木马,但它刚刚开始工作。我做了很多研究,一次又一次地检查,但仍然没有工作。 任何人都可以告诉我为什么?(我刚刚开始,所以一些详细的解释将非常感谢tq)

这是我的代码。



<div class="container-fluid">
    <div class="carousel slide" data-ride="carousel" id="carousel">
        <ol class="carousel-indicators">
            <li data-target="#carousel" data-slide to="0" class="active"></li>
            <li data-target="#carousel" data-slide to="1"></li>
            <li data-target="#carousel" data-slide to="2"></li>
        </ol>
        <div class="carousel-inner">
            <div class="item active">
                <img src="https://f1.media.brightcove.com/8/4495439099001/4495439099001_5325814229001_5305215728001-vs.jpg?pubId=4495439099001&videoId=5305215728001">
            </div>
            <div class="item">
                <img src="http://www.asianews.it/files/img/INDIA_-_0907_-_Vescovo_di_Vasai_su_MT.jpg">
            </div>
            <div class="item">
                <img src="https://www.crossroadsinitiative.com/wp-content/uploads/2016/02/Mother-Teresa-of-Calcutta-Mother-Teresas-National-Prayer-Breakfast-Message.jpg">
            </div>
        </div>
        <a class="carousel-control left" href="#carousel" data-slide="prev">
            <span class="glyphicon glyphicon-chevron-left"></span>
        </a>
        <a class="carousel-control right" href="#carousel" data-slide="next">
            <span class="glyphicon glyphicon-chevron-right"></span>
        </a>
    </div>
</div>
&#13;
&#13;
&#13;

2 个答案:

答案 0 :(得分:1)

添加 Bootstrap &amp; jQuery CDN&#39; s,

您的旋转木马似乎正常工作,

你必须检查其中一个:

  • 如果你没有添加jQuery引用。
  • 如果您已经拥有jQuery,请确保它在引导javascript之前。
  • 如果下载了bootstrap和jQuery并且您在本地使用了它们,请确保使用正确的文档链接。

&#13;
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>

<div class="container-fluid">
    <div class="carousel slide" data-ride="carousel" id="carousel">
        <ol class="carousel-indicators">
            <li data-target="#carousel" data-slide to="0" class="active"></li>
            <li data-target="#carousel" data-slide to="1"></li>
            <li data-target="#carousel" data-slide to="2"></li>
        </ol>
        <div class="carousel-inner">
            <div class="item active">
                <img src="https://f1.media.brightcove.com/8/4495439099001/4495439099001_5325814229001_5305215728001-vs.jpg?pubId=4495439099001&videoId=5305215728001">
            </div>
            <div class="item">
                <img src="http://www.asianews.it/files/img/INDIA_-_0907_-_Vescovo_di_Vasai_su_MT.jpg">
            </div>
            <div class="item">
                <img src="https://www.crossroadsinitiative.com/wp-content/uploads/2016/02/Mother-Teresa-of-Calcutta-Mother-Teresas-National-Prayer-Breakfast-Message.jpg">
            </div>
        </div>
        <a class="carousel-control left" href="#carousel" data-slide="prev">
            <span class="glyphicon glyphicon-chevron-left"></span>
        </a>
        <a class="carousel-control right" href="#carousel" data-slide="next">
            <span class="glyphicon glyphicon-chevron-right"></span>
        </a>
    </div>
</div>
&#13;
&#13;
&#13;

答案 1 :(得分:0)

尝试发布可以运行的完整代码,以便我们可以直接编辑。输出如下。您没有导入库

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container-fluid">
  <div class="carousel slide" data-ride="carousel" id="carousel">

     <ol class="carousel-indicators">
       <li data-target="#carousel" data-slide to="0" class="active"></li>
       <li data-target="#carousel" data-slide to="1"></li>
       <li data-target="#carousel" data-slide to="2"></li>
     </ol>

     <div class="carousel-inner">
       <div class="item active">
         <img src="https://f1.media.brightcove.com/8/4495439099001/4495439099001_5325814229001_5305215728001-vs.jpg?pubId=4495439099001&videoId=5305215728001">
       </div>
       <div class="item">
         <img src="http://www.asianews.it/files/img/INDIA_-_0907_-_Vescovo_di_Vasai_su_MT.jpg">
       </div>
       <div class="item">
         <img src="https://www.crossroadsinitiative.com/wp-content/uploads/2016/02/Mother-Teresa-of-Calcutta-Mother-Teresas-National-Prayer-Breakfast-Message.jpg">
       </div>
    </div>

    <a class="carousel-control left" href="#carousel" data-slide="prev">
      <span class="glyphicon glyphicon-chevron-left"></span>
    </a>
    <a class="carousel-control right" href="#carousel" data-slide="next">
      <span class="glyphicon glyphicon-chevron-right"></span>
    </a>

  </div> 
</div>

</body>
</html>