Swiper carousel slidesPerView无法正常工作

时间:2016-10-27 08:57:39

标签: javascript jquery

我有一张幻灯片,但我的幻灯片重复三个项目!如何停止重复幻灯片?如果有1个幻灯片显示一个,如果是两个幻灯片显示两个,如果是10个幻灯片显示10:|这是我的配置

var swiper = new Swiper('.slides-per-view', {
    pagination: '.swiper-pagination',
    speed: 800,
    loop: true,
    slidesPerView: 3,
    centeredSlides: true,
    spaceBetween: 30,
    grabCursor: true,
    paginationClickable: '.swiper-pagination',
    nextButton: '.swiper-button-next',
    prevButton: '.swiper-button-prev'
});

这是我的Html代码

<div class="swiper-container slides-per-view" dir="rtl">
    <div class="swiper-wrapper">
        <div class="swiper-slide">
            <figure>
                <a href="#"><img draggable="false" src="assets/pictures/activities/1.jpg" class="img-responsive" alt=""></a>
                <figcaption class="text-light text-center"> Title</figcaption>
                <div class="more text-center margin-bottom-30">
                    <p class="text-blue"><i class="fa fa-calendar"></i> Date</p>
                    <a href="" class="btn btn-info-border text-dark transition-5"> Read More </a>
                </div>
            </figure>
        </div>
    </div>
    <div class="swiper-pagination"></div>
    <div class="swiper-button-prev"></div>
    <div class="swiper-button-next"></div>
</div>

请看这个图像 enter image description here

1 个答案:

答案 0 :(得分:2)

如果只有一个图块,则不能将循环设置为true,而将slidePerView设置为3。所以这就是你能做的:

and d.city=2