I have a slick slider that doesn't scroll more than one slide when I swipe on it. I think the code is right but I can't understand why it doesn't scroll 7 slide at time as I want. Maybe I'm not seeing something obvious...
HTML
<div class="slideshow-wrapper">
<div class="preloader"></div>
<div class="homeslick">
<div><img src=""></div>
<div><img src=""></div>
<div><img src=""></div>
<div><img src=""></div>
<div><img src=""></div>
<div><img src=""></div>
<div><img src=""></div>
<div><img src=""></div>
<div><img src=""></div>
<div><img src=""></div>
</div>
</div>
JS
$(document).ready(function(){
$('.homeslick').slick({
infinite: true,
centerMode: true,
centerPadding: '60px',
slidesToShow: 7,
slidesToScroll: 7,
autoplay: true,
autoplaySpeed: 2000,
responsive: [
{
breakpoint: 768,
settings: {
arrows: false,
centerMode: true,
centerPadding: '40px',
slidesToScroll: 7,
slidesToShow: 7
}
},
{
breakpoint: 480,
settings: {
arrows: false,
centerMode: true,
centerPadding: '40px',
slidesToScroll: 3,
slidesToShow: 3
}
}
]
});
});
I have a slick slider that doesn't scroll more than one slide when I swipe on it. I think the code is right but I can't understand why it doesn't scroll 7 slide at time as I want. Maybe I'm not seeing something obvious...
HTML
<div class="slideshow-wrapper">
<div class="preloader"></div>
<div class="homeslick">
<div><img src="https://via.placeholder./150x150"></div>
<div><img src="https://via.placeholder./150x150"></div>
<div><img src="https://via.placeholder./150x150"></div>
<div><img src="https://via.placeholder./150x150"></div>
<div><img src="https://via.placeholder./150x150"></div>
<div><img src="https://via.placeholder./150x150"></div>
<div><img src="https://via.placeholder./150x150"></div>
<div><img src="https://via.placeholder./150x150"></div>
<div><img src="https://via.placeholder./150x150"></div>
<div><img src="https://via.placeholder./150x150"></div>
</div>
</div>
JS
$(document).ready(function(){
$('.homeslick').slick({
infinite: true,
centerMode: true,
centerPadding: '60px',
slidesToShow: 7,
slidesToScroll: 7,
autoplay: true,
autoplaySpeed: 2000,
responsive: [
{
breakpoint: 768,
settings: {
arrows: false,
centerMode: true,
centerPadding: '40px',
slidesToScroll: 7,
slidesToShow: 7
}
},
{
breakpoint: 480,
settings: {
arrows: false,
centerMode: true,
centerPadding: '40px',
slidesToScroll: 3,
slidesToShow: 3
}
}
]
});
});
Share
Improve this question
edited May 2, 2020 at 17:28
Richard Dallaway
4,3301 gold badge29 silver badges39 bronze badges
asked Dec 22, 2017 at 11:52
DaFoisDaFois
2,2238 gold badges28 silver badges47 bronze badges
1 Answer
Reset to default 6Just add the swipeToSlide: true
property.
swipeToSlide - Allow users to drag or swipe directly to a slide irrespective of slidesToScroll.
Type: boolean
Default: false
Documentations Link
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744211018a4563331.html
评论列表(0条)