因为我的swiper是写在选项卡里的,父级的现实隐藏会使swiper失效,所以添加了监视器
var mySwiper1 =new Swiper('.swiper2', {
observer:true,
observeParents:true,
loop:true,
centeredSlides:true,
pagination:'.pagination1',
paginationClickable:true,
prevButton:'.prev1',
nextButton:'.next1',
})
前进后退按钮切换,和手动切换页面正常了,但是分页器的圆点不会随之变化
于是再加上
var mySwiper1 =new Swiper('.swiper2', {
observer:true,
observeParents:true,
loop:true,
centeredSlides:true,
pagination:'.pagination1',
paginationClickable:true,
prevButton:'.prev1',
nextButton:'.next1',
onSlideChangeEnd:function(swiper){
swiper.update()//更新
}
})
就可以正常切换啦