为了账号安全,请及时绑定邮箱和手机立即绑定

Swiper js 自动播放滑块

Swiper js 自动播放滑块

临摹微笑 2023-09-18 15:33:25
我有自动播放 Swiper js 滑块,默认情况下一次显示一张幻灯片,我需要一次显示三张幻灯片(或图像),请告诉我如何调整它。 <!-- Swiper -->    <div class="swiper-container">   <div class="swiper-wrapper">  <div class="swiper-slide">Slide 1</div>  <div class="swiper-slide">Slide 2</div>  <div class="swiper-slide">Slide 3</div>  <div class="swiper-slide">Slide 4</div>  <div class="swiper-slide">Slide 5</div>  <div class="swiper-slide">Slide 6</div>  <div class="swiper-slide">Slide 7</div>  <div class="swiper-slide">Slide 8</div>  <div class="swiper-slide">Slide 9</div>  <div class="swiper-slide">Slide 10</div> </div> <!-- Add Pagination --> <div class="swiper-pagination"></div> <!-- Add Arrows --> <div class="swiper-button-next"></div> <div class="swiper-button-prev"></div></div> <!-- Swiper JS --> <script src="../package/js/swiper.min.js"></script>    <!-- Initialize Swiper -->      <script>       var swiper = new Swiper('.swiper-container', {        spaceBetween: 30,        centeredSlides: true,        autoplay: {        delay: 2500,        disableOnInteraction: false,        },      pagination: {       el: '.swiper-pagination',       clickable: true,       },      navigation: {      nextEl: '.swiper-button-next',      prevEl: '.swiper-button-prev',      },     });   </script>
查看完整描述

2 回答

?
红糖糍粑

TA贡献1815条经验 获得超6个赞

var swiper = new Swiper('.swiper-container', {

  slidesPerView: 3,

  spaceBetween: 30,

  centeredSlides: true,

  autoplay: {

    delay: 2500,

    disableOnInteraction: false,

  },

  pagination: {

    el: '.swiper-pagination',

    clickable: true,

  },

  navigation: {

    nextEl: '.swiper-button-next',

    prevEl: '.swiper-button-prev',

  },

});

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.5.1/css/swiper.min.css">

<script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.5.1/js/swiper.min.js"></script>

<div class="swiper-container">

  <div class="swiper-wrapper">

    <div class="swiper-slide">Slide 1</div>

    <div class="swiper-slide">Slide 2</div>

    <div class="swiper-slide">Slide 3</div>

    <div class="swiper-slide">Slide 4</div>

    <div class="swiper-slide">Slide 5</div>

    <div class="swiper-slide">Slide 6</div>

    <div class="swiper-slide">Slide 7</div>

    <div class="swiper-slide">Slide 8</div>

    <div class="swiper-slide">Slide 9</div>

    <div class="swiper-slide">Slide 10</div>

  </div>

  <!-- Add Pagination -->

  <div class="swiper-pagination"></div>

  <!-- Add Arrows -->

  <div class="swiper-button-next"></div>

  <div class="swiper-button-prev"></div>

</div>


查看完整回答
反对 回复 2023-09-18
?
万千封印

TA贡献1891条经验 获得超3个赞

如果其他人想知道,到目前为止,可以使用一个名为“slidesPerGroup”的参数,它需要您想要滑动的幻灯片数量。



查看完整回答
反对 回复 2023-09-18
  • 2 回答
  • 0 关注
  • 132 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信