gpt4 book ai didi

swiper.js - Swiper 连续循环,滑动之间没有停顿

转载 作者:行者123 更新时间:2023-12-05 01:01:30 28 4
gpt4 key购买 nike

我正在为 swiper 使用这种配置:

var swiper = new Swiper('.swiper-container', {
spaceBetween: 30,
slidesPerView: 3,
speed: 2500,
centeredSlides: true,
autoplay: 1000,
autoplayDisableOnInteraction: false,
loop: true
});

到目前为止,这工作正常。但是刷卡器是否有可能在每 3 张幻灯片之间不停止?现在总是有一个休息时间,直到接下来的 3 张幻灯片滑入。我正在寻找一个无限连续循环 slider 选项。这可能吗?

最佳答案

是的,这是可能的,加油 mariorendic

var swiperOptions = {
loop: true,
freeMode: true,
spaceBetween: 0,
grabCursor: true,
slidesPerView: 7,
loop: true,
autoplay: {
delay: 1,
disableOnInteraction: true
},
freeMode: true,
speed: 5000,
freeModeMomentum: false
};

var swiper = new Swiper(".swiper-container", swiperOptions);
body {
margin: 0;
padding: 0;
background: #eee;
font-family: sans-serif;
font-size: 14px;
background: #404449;

}

.swiper-container {
height: calc(100vh - 120px);
margin: 60px;
}


.swiper-slide {
width: 28vw;
overflow: hidden;
background-position: top;
background-size: cover;
display: flex;
align-items: center;
justify-content: center;
color: white;
font-size: 20px;
font-weight: bold;
}

.swiper-wrapper {
-webkit-transition-timing-function:linear!important;
-o-transition-timing-function:linear!important;
transition-timing-function:linear!important;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.0.7/js/swiper.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.0.7/css/swiper.min.css" rel="stylesheet"/>
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide" style="background-image: url(https://placekeanu.com/250/g);">1</div>
<div class="swiper-slide" style="background-image: url(https://placekeanu.com/260);">2</div>
<div class="swiper-slide" style="background-image: url(https://placekeanu.com/270);">3</div>
<div class="swiper-slide" style="background-image: url(https://placekeanu.com/270/y);">4</div>
<div class="swiper-slide" style="background-image: url(https://placekeanu.com/280/y);">5</div>
<div class="swiper-slide" style="background-image: url(https://placekeanu.com/190/y);">6</div>
<div class="swiper-slide" style="background-image: url(https://placekeanu.com/300/);">7</div>
</div>
</div>

https://codepen.io/tristanisginger/pen/dypxRbv

关于swiper.js - Swiper 连续循环,滑动之间没有停顿,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43801782/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com