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

Swiper js自动播放滑块

Swiper js自动播放滑块

holdtom 2022-05-22 10:34:07
我有自动播放 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贡献1893条经验 获得超10个赞

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>


查看完整回答
反对 回复 2022-05-22
?
慕盖茨4494581

TA贡献1850条经验 获得超11个赞

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



查看完整回答
反对 回复 2022-05-22
  • 2 回答
  • 0 关注
  • 242 浏览
慕课专栏
更多

添加回答

举报

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