解决:使用 swiper 自动轮播图片,当拖动过 swiper 内的内容时,导致不继续自动轮播


版本为1.3

当使用了 swiper 后:

var mySwiper = new Swiper('.banner .swiper-container', {
    autoplay: 3000,
    loop: true,
    pagination: '.swiper-pagination',
    autoplayDisableOnInteraction : false
})
解决办法即是设置这个参数: autoplayDisableOnInteraction 

官网给出的参数介绍:

用户操作 swiper 之后,是否禁止 autoplay 。默认为 true:停止。
如果设置为 false,用户操作 swiper 之后自动切换不会停止,每次都会重新启动 autoplay。
操作包括 触碰,拖动,点击 pagination 等。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM