Shiyan7 Asked:2020-03-31 03:17:33 +0800 CST2020-03-31 03:17:33 +0800 CST 2020-03-31 03:17:33 +0800 CST 带滑动滑块的钝器 772 你好,我不明白如何在滑动条中添加数字如何在活动圈内添加数字添加什么脚本解释 slider 1 个回答 Voted Best Answer vantal 2020-03-31T04:01:41+08:002020-03-31T04:01:41+08:00 这是解决方案,如果我理解正确,您需要这个: var swiper = new Swiper('.swiper-container', { pagination: { el: '.swiper-pagination', clickable: true, renderBullet: function (index, className) { return '<span class="' + className + '">' + (index + 1) + '</span>'; }, }, }); .swiper-container { width: 100%; height: 300px; } .swiper-slide { text-align: center; font-size: 18px; background: #fff; height: 300px; display: -webkit-box; display: -ms-flexbox; display: -webkit-flex; display: flex; -webkit-box-pack: center; -ms-flex-pack: center; -webkit-justify-content: center; justify-content: center; -webkit-box-align: center; -ms-flex-align: center; -webkit-align-items: center; align-items: center; } .swiper-pagination-bullet { width: 20px; height: 20px; text-align: center; line-height: 20px; font-size: 12px; color:#000; opacity: 1; background: rgba(0,0,0,0.2); } .swiper-pagination-bullet-active { color:#fff; background: #007aff; } .swiper-pagination-bullet{ height: 20px !important; width: 20px !important; } <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> <div class="swiper-pagination"></div> </div> <link rel="stylesheet" href="https://unpkg.com/swiper/css/swiper.min.css"> <script src="https://unpkg.com/swiper/js/swiper.min.js"></script>
这是解决方案,如果我理解正确,您需要这个: