swiper实现垂直方向的无限滚动

 JS

 const mySwiper = new Swiper('.swiper-container', {
        slidesPerView: 'auto',
        speed: 5000,//匀速时间,根据实际情况调节
        autoplay: {
          delay: 0,
          stopOnLastSlide: false,
          disableOnInteraction: false
        },
        direction: 'vertical',
        autoHeight:true,
        observer: true,
        observeParents: true,
        loop: true,
      })
 mySwiper.el.onmouseover = function () {
          mySwiper.autoplay.stop();
        }
 mySwiper.el.onmouseleave = function () {
          mySwiper.autoplay.start();
  }

css

 .swiper-container-free-mode>.swiper-wrapper {
      -webkit-transition-timing-function: linear;
      /*之前是ease-out*/
      -moz-transition-timing-function: linear;
      -ms-transition-timing-function: linear;
      -o-transition-timing-function: linear;
      transition-timing-function: linear;
      margin: 0 auto;
    }

你可能感兴趣的:(swiper,JavaScript,Vue,css3,html5,css)