swiper插件的分页器修改

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link rel="stylesheet" href="./swiper/swiper-bundle.min.css" />
    <style>
      .swiper {
        width: 100%;
      }
      .swiper-slide img {
        width: 100%;
        height: 500px;
      }
      /* 修改分页器位置 */
      .swiper-horizontal > .swiper-pagination-bullets,
      .swiper-pagination-bullets.swiper-pagination-horizontal,
      .swiper-pagination-custom,
      .swiper-pagination-fraction {
        bottom: initial;
      }
      /* 修改分页器样式 */
      .swiper-pagination-bullet-active {
        background-color: yellow;
      }
      /* 修改大小 */
      .swiper-pagination-bullet {
        width: 13px;
        height: 13px;
      }
    </style>
  </head>
  <body>
    <div id="swiper">
      <div class="swiper">
        <div class="swiper-wrapper">
          <div class="swiper-slide"><img src="./img/1.jpeg" alt="" /></div>
          <div class="swiper-slide"><img src="./img/2.jpeg" alt="" /></div>
          <div class="swiper-slide"><img src="./img/3.jpeg" alt="" /></div>
          <div class="swiper-slide"><img src="./img/4.jpeg" alt="" /></div>
          <div class="swiper-slide"><img src="./img/5.jpeg" alt="" /></div>
          <div class="swiper-slide"><img src="./img/6.jpg" alt="" /></div>
        </div>
      </div>
      <div class="swiper-pagination"></div>
    </div>
    
    <script src="./swiper/swiper-bundle.min.js"></script>
    <script>
      var mySwiper = new Swiper(".swiper", {
        direction: "horizontal", // 垂直切换选项
        loop: true, // 循环模式选项
        zoom: true,
        freeMode: true, //自动贴合
        speed: 2000, //切换速度
        autoplay: {
          //自动播放
          delay: 2000, //自动切换的时间间隔
          stopOnLastSlide: false, //切换到最后一个slide时停止自动切换
          disableOnInteraction: false, //用户操作后是否停止
        },
        // 如果需要分页器
        pagination: {
          el: ".swiper-pagination",
          clickable: true,
        },
      });
    </script>
  </body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值