Javascript 如何使3张图像一次滑动?
下面的代码一次滑动一个缩略图。我想一次滑3次。有人能帮忙吗。谢谢Javascript 如何使3张图像一次滑动?,javascript,twitter-bootstrap-3,carousel,Javascript,Twitter Bootstrap 3,Carousel,下面的代码一次滑动一个缩略图。我想一次滑3次。有人能帮忙吗。谢谢 $('.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&
$('.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));
}
});
诀窍是使用引导类“row” jQuery
$('#myCarousel').carousel({
interval: 10000
})
html
希望有帮助 你试过什么?为我们提供一个可工作的JSFIDLE(或等效工具),以便我们可以轻松地进行操作。完成此片段,以便我们可以尝试复制您的案例,然后考虑如何修改它。感谢nicolallias的回复。上述示例与相同。因此,我需要在同一时间滑动3张图像,而不是1张图像。而且,字形图标箭头不可见。你能帮忙吗?我想不出比把一切重新编码更简单的方法了。。。直接使用类库进行尝试(第二种情况为“多个项目”),谢谢!我真的想修改代码而不是添加插件。
<div class="col-md-7">
<div id="myCarousel" class="carousel slide">
<div class="carousel-inner">
<div class="item active">
<div class="row">
<div class="col-md-4">
<a href="#"><img src="http://placehold.it/500/bbbbbb/fff&text=1" class="img-responsive"></a>
</div>
<div class="col-md-4">
<a href="#"><img src="http://placehold.it/500/CCCCCC&text=2" class="img-responsive"></a>
</div>
<div class="col-md-4">
<a href="#"><img src="http://placehold.it/500/eeeeee&text=3" class="img-responsive"></a>
</div>
</div>
</div>
<div class="item">
<div class="row">
<div class="col-md-4">
<a href="#"><img src="http://placehold.it/500/f4f4f4&text=4" class="img-responsive"></a>
</div>
<div class="col-md-4">
<a href="#"><img src="http://placehold.it/500/fcfcfc/333&text=5" class="img-responsive"></a>
</div>
<div class="col-md-4">
<a href="#"><img src="http://placehold.it/500/f477f4/fff&text=6" class="img-responsive"></a>
</div>
</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>
.carousel-inner .active.left { left: -33%; }
.carousel-inner .next { left: 33%; }
.carousel-inner .prev { left: -33%; }
.carousel-control.left,.carousel-control.right {background-image:none; color: black;}