swiper鼠标放上停止轮播事件

文章2020-04-14382 人已阅来源:网络

swiper效果鼠标经过停止轮播,鼠标离开继续播放

 var swiper = new Swiper('.swiper-container', {
    slidesPerView: 10,
    direction: 'vertical',
    autoplay:{
      delay: 2500,
      disableOnInteraction: false,
    },
    pagination: {
      el: '.swiper-pagination',
      clickable: true,
    },
});
swiper.el.onmouseleave = function(){
    swiper.autoplay.start();
},
swiper.el.onmouseover = function(){ 
    swiper.autoplay.stop();
} 

swiper 官网