圆滑的旋转木马 - 无限不停的表演
Slick carousel - unlimted no-stopping show
我需要制作光滑的旋转木马自动移动,无穷无尽且不停顿。这是我已经拥有的:
$('#carousel').slick({
slidesToShow: 3,
autoplay: true,
autoplaySpeed: 1000,
speed: 1000,
infinite: true,
focusOnSelect: false,
responsive: [{
breakpoint: 768,
settings: {
arrows: false,
slidesToShow: 3
}
}, {
breakpoint: 480,
settings: {
arrows: false,
slidesToShow: 1
}
}]
});
<link href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.5.9/slick.min.css" rel="stylesheet"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.5.9/slick-theme.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.5.9/slick.min.js"></script>
<div id="carousel">
<div><a href="#"><img src="http://placehold.it/205x105" /></a></div>
<div><a href="#"><img src="http://placehold.it/205x105/f00/fff" /></a></div>
<div><a href="#"><img src="http://placehold.it/205x105/00f/fff" /></a></div>
<div><a href="#"><img src="http://placehold.it/205x105" /></a></div>
<div><a href="#"><img src="http://placehold.it/205x105/f00/fff" /></a></div>
<div><a href="#"><img src="http://placehold.it/205x105/00f/fff" /></a></div>
</div>
但是正如你所看到的,当它移动到另一张幻灯片时,它会停一会儿然后移动到下一张。我想不停地慢慢运行。我想你明白我的意思。
您需要设置 autospeed: 0
并添加 cssEase:linear
这将提供您正在寻找的自动收报机效果。
$('#carousel').slick({
slidesToShow: 3,
autoplay: true,
autoplaySpeed: 0,
speed: 2000,
cssEase:'linear',
infinite: true,
focusOnSelect: false,
responsive: [{
breakpoint: 768,
settings: {
arrows: false,
slidesToShow: 3
}
}, {
breakpoint: 480,
settings: {
arrows: false,
slidesToShow: 1
}
}]
});
<link href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.5.9/slick.min.css" rel="stylesheet"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.5.9/slick-theme.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.5.9/slick.min.js"></script>
<div id="carousel">
<div><a href="#"><img src="http://placehold.it/205x105" /></a></div>
<div><a href="#"><img src="http://placehold.it/205x105/f00/fff" /></a></div>
<div><a href="#"><img src="http://placehold.it/205x105/00f/fff" /></a></div>
<div><a href="#"><img src="http://placehold.it/205x105" /></a></div>
<div><a href="#"><img src="http://placehold.it/205x105/f00/fff" /></a></div>
<div><a href="#"><img src="http://placehold.it/205x105/00f/fff" /></a></div>
</div>
我需要制作光滑的旋转木马自动移动,无穷无尽且不停顿。这是我已经拥有的:
$('#carousel').slick({
slidesToShow: 3,
autoplay: true,
autoplaySpeed: 1000,
speed: 1000,
infinite: true,
focusOnSelect: false,
responsive: [{
breakpoint: 768,
settings: {
arrows: false,
slidesToShow: 3
}
}, {
breakpoint: 480,
settings: {
arrows: false,
slidesToShow: 1
}
}]
});
<link href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.5.9/slick.min.css" rel="stylesheet"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.5.9/slick-theme.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.5.9/slick.min.js"></script>
<div id="carousel">
<div><a href="#"><img src="http://placehold.it/205x105" /></a></div>
<div><a href="#"><img src="http://placehold.it/205x105/f00/fff" /></a></div>
<div><a href="#"><img src="http://placehold.it/205x105/00f/fff" /></a></div>
<div><a href="#"><img src="http://placehold.it/205x105" /></a></div>
<div><a href="#"><img src="http://placehold.it/205x105/f00/fff" /></a></div>
<div><a href="#"><img src="http://placehold.it/205x105/00f/fff" /></a></div>
</div>
但是正如你所看到的,当它移动到另一张幻灯片时,它会停一会儿然后移动到下一张。我想不停地慢慢运行。我想你明白我的意思。
您需要设置 autospeed: 0
并添加 cssEase:linear
这将提供您正在寻找的自动收报机效果。
$('#carousel').slick({
slidesToShow: 3,
autoplay: true,
autoplaySpeed: 0,
speed: 2000,
cssEase:'linear',
infinite: true,
focusOnSelect: false,
responsive: [{
breakpoint: 768,
settings: {
arrows: false,
slidesToShow: 3
}
}, {
breakpoint: 480,
settings: {
arrows: false,
slidesToShow: 1
}
}]
});
<link href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.5.9/slick.min.css" rel="stylesheet"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.5.9/slick-theme.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.5.9/slick.min.js"></script>
<div id="carousel">
<div><a href="#"><img src="http://placehold.it/205x105" /></a></div>
<div><a href="#"><img src="http://placehold.it/205x105/f00/fff" /></a></div>
<div><a href="#"><img src="http://placehold.it/205x105/00f/fff" /></a></div>
<div><a href="#"><img src="http://placehold.it/205x105" /></a></div>
<div><a href="#"><img src="http://placehold.it/205x105/f00/fff" /></a></div>
<div><a href="#"><img src="http://placehold.it/205x105/00f/fff" /></a></div>
</div>