javascript - swiper.js has nested swiper. The initial setting cannot slide to the next one. Re-initialize after the end.
漂亮男人
漂亮男人 2017-06-28 09:27:46
0
1
823
 var swiperV = new Swiper('.swiper-container-v', {
        pagination: '.swiper-pagination-v',
        paginationClickable: true,
        direction: 'vertical',
        allowSwipeToNext: false,
        observer: true,
        observeParents: true
    });
    var swiperH = new Swiper('.swiper-container-h', {
        pagination: '.swiper-pagination-h',
        paginationClickable: true,
        direction: 'horizontal',
        resistanceRatio: 0,
        prevButton: '.swiper-button-prev',
        nextButton: '.swiper-button-next',
        a11y: true,
        initialSlide: initSceneIndex,
        onInit: function (swiper) { //Swiper2.x的初始化是onFirstInit
            swiperAnimateCache(swiper); //隐藏动画元素
            swiperAnimate(swiper); //初始化完成开始动画
        },
        onSlideChangeEnd: function (swiper) {
            swiperAnimate(swiper); //每个slide切换结束时也运行当前slide动画
        }
    });
    

Drag and drop completed

 swiperV.allowSwipeToNext=true;

How to re-initialize

漂亮男人
漂亮男人

reply all(1)
女神的闺蜜爱上我

I happen to be using Swiper recently, but there is no need to re-initialize it. I took a look at the documentation:

Updating the configuration should be through the paramsattribute:

swiperV.params.allowSwipeToNext = true;

Then it needs to be reinitialized:

swiperV.reInit(); // 2.x
swiperV.update(); // 3.x
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template