twitter-bootstrap 无法使 Bootstrap Carousel 基本示例工作

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17925675/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 17:45:16  来源:igfitidea点击:

Can't Get Bootstrap Carousel Basic Example Working

twitter-bootstrapcarousel

提问by richcollins

This carousellooks pretty straightforward but I can't get it working

这个旋转木马看起来很简单,但我无法让它工作

Any help greatly appreciated :-)

非常感谢任何帮助:-)

回答by David Taiaroa

See it this helps: http://www.bootply.com/70201

看到它有帮助:http: //www.bootply.com/70201

It's using Bootstrap 3, with the HTML lifted directly from the carousel example on the Bootstrap docsand javascript

它使用 Bootstrap 3,HTML 直接从Bootstrap 文档和 javascript 上的轮播示例中提取

<script type="text/javascript" >
            $(document).ready(function() {        
        $('.carousel').carousel()
            });
</script>    

I also noticed that the source for your placeholder images is down for me at the moment so I'm using another URL for the slide images

我还注意到,您的占位符图像的来源目前对我来说已关闭,因此我正在为幻灯片图像使用另一个 URL

Goold luck!

祝你好运!

HTML

HTML

<div id="carousel-example-generic" class="carousel slide">
<!-- 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>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
</ol>

<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
  <img src="http://placehold.it/900x500" alt="">
  <div class="carousel-caption">
    slide 1
  </div>
</div>
<div class="item">
  <img src="http://placehold.it/900x500" alt="">
  <div class="carousel-caption">
    slide 2
  </div>
</div>
<div class="item">
  <img src="http://placehold.it/900x500" alt="">
  <div class="carousel-caption">
    slide 3
  </div>
</div>
</div>

<!-- Controls -->
<a class="left carousel-control" href="#carousel-example-generic" data-slide="prev">
<span class="icon-prev"></span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" data-slide="next">
<span class="icon-next"></span>
</a>
</div>

回答by cilerler

You do not have holder.js included in your code please add the following line

您的代码中没有包含 holder.js 请添加以下行

<script type='text/javascript' src="http://imsky.github.io/holder/holder.js"></script>