Swiper 匀速无缝轮播
<!-- 引入 Swiper 的样式文件 -->
<link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.min.css">
<!-- 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>
</div>
<!-- 引入 Swiper 的 JS 文件 -->
<script src="https://unpkg.com/swiper/swiper-bundle.min.js"></script>
<script>
var swiper = new Swiper('.swiper-container', {
speed: 3000, // 轮播切换的速度,单位为毫秒
loop: true, // 是否开启循环模式
autoplay: {
delay: 0, // 每个幻灯片停留的时间,单位为毫秒
disableOnInteraction: false, // 用户交互后是否禁止自动播放
},
});
</script>
<style>
.swiper-container .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;
}
</style>
本文是原创文章,采用 CC BY-NC-ND 4.0 协议,完整转载请注明来自 KafuuChino
评论
匿名评论
隐私政策
你无需删除空行,直接评论以获取最佳展示效果