最近项目首页轮播图用了Swiper轮播,今天突然发现轮播图动画初始正常但是手动换过之后就不动了,解决方法有两种,具体根据采用的情况为准:

1、autoplayDisableOnInteraction:false,

var mySwiper = new Swiper(".swiper-container", {
    autoplay: 3000, //可选选项,自动滑动
    autoplayDisableOnInteraction:false,
    observer: true,
    observeParents: true,
    paginationClickable: true,
    watchSlidesProgress: true,
    watchSlidesVisibility: true
});
                    
                        

当autoplayDisableOnInteraction:false的时候,手动滑动自动滑动不会失效

 

2、网上最多的:disableOnInteraction:false,

var mySwiper = new Swiper(".swiper-container", {
    autoplay: {
      delay: 2500,
      disableOnInteraction: false,
    },
    observer: true,
    observeParents: true,
    paginationClickable: true,
    watchSlidesProgress: true,
    watchSlidesVisibility: true
});

话不多说,其实只是写法不用,属性作用一样。

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-11
  • 2022-12-23
  • 2022-12-23
  • 2021-09-11
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-22
  • 2022-12-23
  • 2021-11-22
  • 2022-12-23
  • 2022-01-14
相关资源
相似解决方案