Bootstrap 3.3 Carousel - 3个图像逐个滑动

时间:2015-05-14 14:37:48

标签: javascript css twitter-bootstrap twitter-bootstrap-3 carousel

我想要显示3个缩略图和onClick of arrow,它必须一次只滚动一个...当涉及3.3版时,它一次滚动3个缩略图...(但它显示的确切我之后想要的是什么。)我该如何解决这个问题。

  <div class="container">
    <div class="row">
        <div class="span12">
            <div class="well">
                <div id="myCarousel" class="carousel fdi-Carousel slide">
                 <!-- Carousel items -->
                    <div class="carousel fdi-Carousel slide" id="eventCarousel" data-interval="0">
                        <div class="carousel-inner onebyone-carosel">
                            <div class="item active">
                                <div class="col-md-4">
                                    <a href="#"><img src="http://placehold.it/250x250" class="img-responsive center-block"></a>
                                    <div class="text-center">1</div>
                                </div>
                            </div>
                            <div class="item">
                                <div class="col-md-4">
                                    <a href="#"><img src="http://placehold.it/250x250" class="img-responsive center-block"></a>
                                    <div class="text-center">2</div>
                                </div>
                            </div>
                            <div class="item">
                                <div class="col-md-4">
                                    <a href="#"><img src="http://placehold.it/250x250" class="img-responsive center-block"></a>
                                    <div class="text-center">3</div>
                                </div>
                            </div>
                            <div class="item">
                                <div class="col-md-4">
                                    <a href="#"><img src="http://placehold.it/250x250" class="img-responsive center-block"></a>
                                    <div class="text-center">4</div>
                                </div>
                            </div>
                            <div class="item">
                                <div class="col-md-4">
                                    <a href="#"><img src="http://placehold.it/250x250" class="img-responsive center-block"></a>
                                    <div class="text-center">5</div>
                                </div>
                            </div>
                            <div class="item">
                                <div class="col-md-4">
                                    <a href="#"><img src="http://placehold.it/250x250" class="img-responsive center-block"></a>
                                    <div class="text-center">6</div>
                                </div>
                            </div>
                        </div>
                        <a class="left carousel-control" href="#eventCarousel" data-slide="prev"></a>
                        <a class="right carousel-control" href="#eventCarousel" data-slide="next"></a>
                    </div>
                    <!--/carousel-inner-->
                </div><!--/myCarousel-->
            </div><!--/well-->
        </div>
    </div>
</div>

En de javascript:

$(document).ready(function () {
$('#myCarousel').carousel({
    interval: 10000
})
$('.fdi-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));
    }
});

});

JSFiddle:http://jsfiddle.net/Luuw070f/

1 个答案:

答案 0 :(得分:1)

这是transform属性

的变通方法

http://jsfiddle.net/rewobs/Luuw070f/4/