我一直在玩自举转盘,试图让它每张幻灯片都显示4列.事情的响应方面是完美的,但是当最后一张幻灯片幻灯片转盘不回绕到第一张幻灯片时.它只是消失了谁能识别问题?
<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"> <!-- Slide --> <div class="item active"> <div class="row"> <div class="col-sm-3 col-xs-6"> <img src="http://placehold.it/260x180" alt=""/> <div class="carousel-caption">This is a caption</div> </div> <div class="col-sm-3 col-xs-6"> <img src="http://placehold.it/260x180" alt=""/> <div class="carousel-caption">This is a caption</div> </div> <div class="col-sm-3 col-xs-6"> <img src="http://placehold.it/260x180" alt=""/> <div class="carousel-caption">This is a caption</div> </div> <div class="col-sm-3 col-xs-6"> <img src="http://placehold.it/260x180" alt=""/> <div class="carousel-caption">This is a caption</div> </div> </div> </div> <!-- Slide --> <div class="item"> <div class="row"> <div class="col-sm-3 col-xs-6"> <img src="http://placehold.it/260x180" alt=""/> <div class="carousel-caption">This is a caption</div> </div> <div class="col-sm-3 col-xs-6"> <img src="http://placehold.it/260x180" alt=""/> <div class="carousel-caption">This is a caption</div> </div> <div class="col-sm-3 col-xs-6"> <img src="http://placehold.it/260x180" alt=""/> <div class="carousel-caption">This is a caption</div> </div> <div class="col-sm-3 col-xs-6"> <img src="http://placehold.it/260x180" alt=""/> <div class="carousel-caption">This is a caption</div> </div> </div> </div> <!-- Slide --> <div class="item"> <div class="row"> <div class="col-sm-3 col-xs-6"> <img src="http://placehold.it/260x180" alt=""/> <div class="carousel-caption">This is a caption</div> </div> <div class="col-sm-3 col-xs-6"> <img src="http://placehold.it/260x180" alt=""/> <div class="carousel-caption">This is a caption</div> </div> <div class="col-sm-3 col-xs-6"> <img src="http://placehold.it/260x180" alt=""/> <div class="carousel-caption">This is a caption</div> </div> <div class="col-sm-3 col-xs-6"> <img src="http://placehold.it/260x180" alt=""/> <div class="carousel-caption">This is a caption</div> </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>
JS
$('#carousel-example-generic').carousel();
CSS
.carousel.slide img { width:100%; height:auto; }
[更新]这是一个更新的jsFiddle工作 – 感谢Adrift!
[update2] http://jsfiddle.net/S2rnm/795/此版本响应式显示不同的传送带,包含4,2或1列,具体取决于设备大小.它需要3个旋转木马的每个具有不同的可见x类.
解决方法
问题是你有.carousel-inner内的转盘控件 – 你只需要把它们放在这个类之外:
</div> <!-- Close the .carousel-inner class before the 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>