Vue全套学习学习视频:B站
小胖梅-的个人空间_哔哩哔哩_Bilibili
swiper 是一个开源免费的移动触摸插件。swiper3.0版本使用。
onSlideChangeEnd回调偶尔不触发,或者是pc端触发,但是手机端不触发
在使用中遇到这样一个问题,记录一下。
page 间切换效果 使用 fade 的时候,如果每个页面的大小不一样, 比如第一个页面全屏, 第二个页面比第一个小, 那么切换到第二页的时候, 第一页的内容还可以看到。
还有,使用 fade
过度方法,onSlideChangeEnd
回调偶尔触发,偶尔不触发。 因此使用 onTransitionEnd;
解决方案:
- 添加 fade:{crossFade:true}
- 切换之后效果, 使用 onSlideChangeEnd(page切换后触发) 会偶尔不触发, 请使用 onTransitionEnd(过度效果结束触发)
| var mySwiper = new Swiper( '.swiper-container' ,{<br> pagination: '.swiper-pagination' ,<br> nextButton: '.swiper-button-next' , prevButton: '.swiper-button-prev' , effect: 'fade' ,<br> // tips fade: { crossFade: true , }, onTransitionEnd: function (swiper) { console.info( "页面跳转到第:" , swiper.activeIndex, " 页" ) } |