无法获取Bootstrap Carousel基本示例工作

时间:2013-07-29 13:42:36

标签: twitter-bootstrap carousel

carousel看起来很简单,但我无法正常工作

非常感谢任何帮助: - )

2 个答案:

答案 0 :(得分:9)

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

它正在使用Bootstrap 3,直接从Bootstrap docs和javascript

上的轮播示例中提取HTML
<script type="text/javascript" >
            $(document).ready(function() {        
        $('.carousel').carousel()
            });
</script>    

我还注意到,我的占位符图片的来源目前已关闭,所以我正在使用其他网址作为幻灯片图片

Goold运气好!

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>

答案 1 :(得分:4)

您的代码中没有holder.js请添加以下内容

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