隐藏的div中的Swiper

时间:2017-01-29 11:17:58

标签: javascript jquery html swiper

我的滑杆滑块有问题。我们在页面上有2个隐藏的幻灯片,第1个可见工作正常,但其他不工作,所有幻灯片都有全宽,并且不滚动。

 var swiper2;
$(document).ready(function(){
        swiper2 = new Swiper('.swiper-container-height-mod2', {
            nextButton: '.swiper-button-next',
            prevButton: '.swiper-button-prev',
            slidesPerView: 1,
            paginationClickable: true,
            spaceBetween: 30,
            breakpoints: {
                // when window width is <= 960px
                767: {
                    slidesPerView: 1
                }
            },
        });
});

1 个答案:

答案 0 :(得分:2)

添加到选项

{
observer: true,
observeParents: true
}