Wie können wir die Anzahl der Bilder im Bootstrap Carousal ändern. Im folgenden Code standardmäßig 3 Bilder angezeigt, die gescrollt werden können, um andere zu sehen, so anstelle von 3 Ich möchte die Zahl zu 4 oder 5 oder 6 ändern. Wie geht das?Bootstrap Carousal - Anzahl der Bilder
Bootstrap Carousal. Ändern Vorgabe Anzahl der Bilder
HTML:
<div class="container">
<h1>Use Bootstrap's carousel to show multiple items per slide.</h1>
<div class="row">
<div class="col-md-12">
<div class="carousel slide multi-item-carousel" id="theCarousel">
<div class="carousel-inner">
<div class="item active">
<div class="col-xs-4"><a href="#1"><img src="http://placehold.it/300/f44336/000000" class="img-responsive"></a></div>
</div>
<div class="item">
<div class="col-xs-4"><a href="#1"><img src="http://placehold.it/300/e91e63/000000" class="img-responsive"></a></div>
</div>
<div class="item">
<div class="col-xs-4"><a href="#1"><img src="http://placehold.it/300/9c27b0/000000" class="img-responsive"></a></div>
</div>
<div class="item">
<div class="col-xs-4"><a href="#1"><img src="http://placehold.it/300/673ab7/000000" class="img-responsive"></a></div>
</div>
<div class="item">
<div class="col-xs-4"><a href="#1"><img src="http://placehold.it/300/4caf50/000000" class="img-responsive"></a></div>
</div>
<div class="item">
<div class="col-xs-4"><a href="#1"><img src="http://placehold.it/300/8bc34a/000000" class="img-responsive"></a></div>
</div>
</div>
<a class="left carousel-control" href="#theCarousel" data-slide="prev"><i class="glyphicon glyphicon-chevron-left"></i></a>
<a class="right carousel-control" href="#theCarousel" data-slide="next"><i class="glyphicon glyphicon-chevron-right"></i></a>
</div>
</div>
</div>
</div>
JavaScript
$('.multi-item-carousel').carousel({
interval: false
});
// for every slide in carousel, copy the next slide's item in the slide.
// Do the same for the next, next item.
$('.multi-item-carousel .item').each(function() {
var next = $(this).next();
if (!next.length) {
next = $(this).siblings(':first');
}
next.children(':first-child').clone().appendTo($(this));
if (next.next().length > 0) {
next.next().children(':first-child').clone().appendTo($(this));
} else {
$(this).siblings(':first').children(':first-child').clone().appendTo($(this));
}
});
Es angezeigte Bild wie folgt:
So anstelle von 3 Bildern, ich will um 4 oder 5 Bilder anzuzeigen, ich s nicht ee jede Einstellung im Zusammenhang mit Script.
Ich weiß nicht, ob es aktualisiert wird, aber Das war in Bootstrap 2 nicht möglich, obwohl dieser Typ einen Workaround hatte ... http: //stackoverflow.com/questions/9745746/twitter-bootstrap-2-carousel-display-a-set-of-thumbnails- zu einer Zeit wie-jcarou/9758836 # 9758836. – CZorio
http://www.owlcarousel.owlgraphic.com/ Dieses Plugin wird Ihnen helfen zu tun, was Sie wollen –