Bootstrap Carousel无法转到下一张图片

时间:2014-07-07 21:35:39

标签: html twitter-bootstrap carousel

我无法点击箭头或点。另外,hpw可以让它自动进入下一张幻灯片吗?什么都行不通。任何帮助将不胜感激。谢谢!

继承我的代码:

    <div id="myCarousel" class="carousel slide">
  <!-- 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>
 <div class="carousel-inner">
<div class="item active">
  <img src="img/Carousel0.png" class="img-responsive">
  <div class="container">
    <div class="carousel-caption">
      <h1>Bootstrap 3 Carousel Layout</h1>
      <pthis is="" an="" example="" layout="" with="" carousel="" that="" uses="" the="" bootstrap="" 3="" styles.<="" small=""><p></p>
      <p><a class="btn btn-lg btn-primary" href="http://getbootstrap.com">Learn More</a>
    </p></pthis></div>
  </div>
</div>
<div class="item">
  <img src="img/Carousel1.png" class="img-responsive">
  <div class="container">
    <div class="carousel-caption">
      <h1>Changes to the Grid</h1>
      <p>Bootstrap 3 still features a 12-column grid, but many of the CSS class names have completely changed.</p>
      <p><a class="btn btn-large btn-primary" href="#">Learn more</a></p>
    </div>
  </div>
</div>
<div class="item">
  <img src="img/Carousel2.png" class="img-responsive">
  <div class="container">
    <div class="carousel-caption">
      <h1>Percentage-based sizing</h1>
      <p>With "mobile-first" there is now only one percentage-based grid.</p>
      <p><a class="btn btn-large btn-primary" href="#">Browse gallery</a></p>
    </div>
  </div>
</div>

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

1 个答案:

答案 0 :(得分:0)

您在carousel-inner div内导航。将结束div移动到导航上方可以解决您的问题。

<div id="myCarousel" class="carousel slide">
<!-- 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>
<div class="carousel-inner">
  <div class="item active">
    <img src="img/Carousel0.png" class="img-responsive">
    <div class="container">
      <div class="carousel-caption">
        <h1>Bootstrap 3 Carousel Layout</h1>
        <pthis is="" an="" example="" layout="" with="" carousel="" that="" uses="" the="" bootstrap="" 3="" styles.<="" small=""><p></p>
        <p><a class="btn btn-lg btn-primary" href="http://getbootstrap.com">Learn More</a>
      </p></pthis></div>
    </div>
  </div>
  <div class="item">
    <img src="img/Carousel1.png" class="img-responsive">
    <div class="container">
      <div class="carousel-caption">
        <h1>Changes to the Grid</h1>
        <p>Bootstrap 3 still features a 12-column grid, but many of the CSS class names have completely changed.</p>
        <p><a class="btn btn-large btn-primary" href="#">Learn more</a></p>
      </div>
    </div>
  </div>
  <div class="item">
    <img src="img/Carousel2.png" class="img-responsive">
    <div class="container">
      <div class="carousel-caption">
        <h1>Percentage-based sizing</h1>
        <p>With "mobile-first" there is now only one percentage-based grid.</p>
        <p><a class="btn btn-large btn-primary" href="#">Browse gallery</a></p>
      </div>
    </div>
  </div>
</div>
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
  <span class="icon-prev"></span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
  <span class="icon-next"></span>
</a>

Bootply