swiper4以上鼠标经过停止自动轮播,鼠标离开开始自动切换:
var mySwiper = new Swiper(’.swiper’,{
autoplay : true,
})
//鼠标覆盖停止自动切换
mySwiper.el.onmouseover = function(){
mySwiper.autoplay.stop();
}
//鼠标离开开始自动切换
mySwiper.el.onmouseout = function(){
mySwiper.autoplay.start();
}
可参考官方中文网(https://www.swiper.com.cn/api/autoplay/112.html)
swiper3可参考官方中文网(https://3.swiper.com.cn/api/function/2014/1218/112.html)