Bootstrap Carousel图像显示在彼此之上

时间:2015-03-11 14:24:54

标签: jquery twitter-bootstrap carousel

当我使用以下代码时,第二张幻灯片的图像和标题显示在第一张幻灯片的图像和标题上,滑块停止工作。下面是我的代码,任何人都可以帮我弄清楚如何将第二张图片和标题移动到第二张幻灯片而不是第一张?

<!--Carousel Code -->

    <div id="myCarousel" class="carousel slide" data-ride="carousel">
  <!-- Indicators -->
  <ol class="carousel-indicators">
    <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
    <li data-target="#myCarousel" data-slide-to="1"></li>
    <li data-target="#myCarousel" data-slide-to="2"></li>
  </ol>

  <!-- Wrapper for slides -->
  <div class="carousel-inner" role="listbox">
    <div class="itemactive">
      <img src="./clothes-hanger.png" alt="First slide">
       <div class="carousel-caption">
        <h1>First title</h1>
       <br><strong><p>First paragraph</p></strong></br>
    </div>
    </div>
    <div class="item2">
      <img src="./clothes-hanger.png" alt="Second slide">
      <div class="carousel-caption">
        <h1>Second title</h1>
        <br><strong><p>Second paragraph</p></strong></br>
      </div>
    </div>
    ...
  </div class="item3">
<img src="" alt="">
<div class="carousel-caption">
<h1></h1>
<p></p>
</div>
</div>
</div>

  <!-- Controls -->
  <a class="left carousel-control" href="#myCarousel" 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="#myCarousel" role="button" data-slide="next">

    <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
    <span class="sr-only">Next</span>
  </a>
</div>
                </div>
            </div>
        </div>
    </section>

1 个答案:

答案 0 :(得分:0)

基本上你有错误的css类。请检查http://plnkr.co/edit/pb9ubz2Za4Ikpc1k0QzW?p=preview

e.g

,你应该有第一张幻灯片

<div class="item active">
</div>

为第二个

<div class="item">
</div>

和第三次

<div class="item">
</div>