Bootstrap - Carousel不起作用。显示所有图片,但没有动画

时间:2017-04-22 16:50:54

标签: html twitter-bootstrap carousel

我是新手,我刚刚开始学习bootstrap。我现在发现了一个问题,我试图解决它大约一个小时。我的旋转木马画廊不起作用。它一次显示所有图片。

这是我的代码: `

<div class="container-fluid">
            <div class="row">
                <div class="col-md-12">
                    <div id="myowncarousel" class="carousel slide">
                        <ol class="carousel-indicators">
                          <li data-target="#myowncarousel" data-slide-to="0" class="active"></li>
                          <li data-target="#myowncarousel" data-slide-to="1"></li>
                          <li data-target="#myowncarousel" data-slide-to="2"></li>
                        </ol>
                        <div class="carousel-inner">
                            <div class="item active">
                            <img src="img/banner_1.png" alt="">
                            </div>
                            <div class="item">
                            <img src="img/banner_2.png" alt="">
                            </div>
                            <div class="item">
                            <img src="img/banner_3.png" alt="">
                            </div>
                        </div>
                        <a class="left carousel-control" href="#myowncarousel" data-slide="prev">
                        <span class="icon-prev"></span></a>
                        <a class="right carousel-control" href="#myowncarousel" data-slide="next">
                        <span class="icon-next"></span></a>
                    </div>
                </div>
            </div>      
        </div>

` 我非常感谢你的帮助!

编辑:

    <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <meta http-equiv="x-ua-compatible" content="ie=edge">
        <meta http-equiv="Refresh" content="30" />
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous"/>
        <link href="css/style.css" type="text/css" rel="stylesheet"/>
      </head>
      <body>
...

<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>
  </body>

这就是我加载bootstrap文件的方式。我希望没关系。

1 个答案:

答案 0 :(得分:0)

您在导入中使用Bootstrap v4,但在Bootstrap 3

中使用html代码

所以,要解决这个问题你应该:

  • 将Bootstrap 3添加到您的导入
  • 将您的代码更改为bootstrap 4

jsfiddle