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
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
params
attribute:Then it needs to be reinitialized: