swiper鼠标放上停止轮播事件

版权声明:我写的你不能转载,但是你可以复制啊。复制记得加关注啊(迷之微笑)。 https://blog.csdn.net/quhongqiang/article/details/84936977
var mySwiper = new Swiper('.swiper-container', {
      spaceBetween: 30,
      centeredSlides: true,
      loop: true, //循环播放
      autoplay: { //播放时间间隔
        delay: 5000,
        disableOnInteraction: false,
      },
      pagination: {
        el: '.swiper-pagination',
        clickable: true,
      },
      // navigation: {
      //   nextEl: '.swiper-button-next',
      //   prevEl: '.swiper-button-prev',
      // },
    });
    mySwiper.el.onmouseover = function(){ //鼠标放上暂停轮播
      mySwiper.autoplay.stop();
    }
    mySwiper.el.onmouseleave = function(){
      mySwiper.autoplay.start();
    }

猜你喜欢

转载自blog.csdn.net/quhongqiang/article/details/84936977
今日推荐