I want to implement a Bootstrap 3 carousel with multiple items on my page and it should move one image each step. I tried using a few examples that I found and every time the same problem. When I inspect element, I see 4 images in each item and then it moves the item but all the 4 images are moving together.
At the moment I use the example I found here.
This is My page that I use the carousel in.
Please help!
I add my HTML code here
<div class="col-xs-12 text-center" style=" direction: ltr">
<div class="col-md-10 col-md-offset-1">
<div class="carousel slide" id="myCarousel">
<div class="carousel-inner">
<div class="item active">
<div class="col-md-3"><a href="#"><img src="http://www.sea-gal.co.il/sysvault/docsgalleries28/thcdp635830250227371376.jpg" class="img-responsive"></a></div>
</div>
<div class="item">
<div class="col-md-3"><a href="#"><img src="http://www.sea-gal.co.il/sysvault/docsgalleries28/thcdp635830250229867424.jpg" class="img-responsive"></a></div>
</div>
<div class="item">
<div class="col-md-3"><a href="#"><img src="http://www.sea-gal.co.il/sysvault/docsgalleries28/thcdp635830250232831481.jpg" class="img-responsive"></a></div>
</div>
<div class="item">
<div class="col-md-3"><a href="#"><img src="http://www.sea-gal.co.il/sysvault/docsgalleries28/thcdp635830250234859520.jpg" class="img-responsive"></a></div>
</div>
<div class="item">
<div class="col-md-3"><a href="#"><img src="http://www.sea-gal.co.il/sysvault/docsgalleries28/thcdp635830250236731556.jpg" class="img-responsive"></a></div>
</div>
<div class="item">
<div class="col-md-3"><a href="#"><img src="http://www.sea-gal.co.il/sysvault/docsgalleries28/thcdp635830250238603592.jpg" class="img-responsive"></a></div>
</div>
<div class="item">
<div class="col-md-3"><a href="#"><img src="http://www.sea-gal.co.il/sysvault/docsgalleries28/thcdp635830250240475628.jpg" class="img-responsive"></a></div>
</div>
<div class="item">
<div class="col-md-3"><a href="#"><img src="http://www.sea-gal.co.il/sysvault/docsgalleries28/thcdp635830250242503667.jpg" class="img-responsive"></a></div>
</div>
</div>
<a class="left carousel-control" href="#myCarousel" data-slide="prev"><i class="glyphicon glyphicon-chevron-left"></i></a>
<a class="right carousel-control" href="#myCarousel" data-slide="next"><i class="glyphicon glyphicon-chevron-right"></i></a>
</div>
</div>
and this ios the javascript i'm using:
$(document).ready(function () {
$('#myCarousel').carousel({
interval: 4000
})
$('.carousel .item').each(function(){
var next = $(this).next();
if (!next.length) {
next = $(this).siblings(':first');
}
next.children(':first-child').clone().appendTo($(this));
for (var i=0;i<2;i++) {
next=next.next();
if (!next.length) {
next = $(this).siblings(':first');
}
next.children(':first-child').clone().appendTo($(this));
}
});
});
and this is the css i'm using:
.carousel-inner .active.left { left: -25% ; }
.carousel-inner .next { left: 25% ; }
.carousel-inner .prev { left: -25% ; }
.carousel-control { width: 4%; }
.carousel-control.left,.carousel-control.right {margin-left:-15px;background-image:none;}