A
A
ayapergenov2015-09-30 20:25:28
JavaScript
ayapergenov, 2015-09-30 20:25:28

How to set a different number of slides for different screens?

In a slider based on the slick plugin
plugin, the number of simultaneously displayed slides is described by

$('.multiple-items').slick({
slidesToShow: 3,
});

For desktop I need 3 slides. And for 768px only 2, and 320px only 1 slide.
Which script can set the number of slides depending on the screen size?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikita Musikhin, 2015-09-30
@ayapergenov

I'm certainly not a wang, but I think that this documentation block can help -
$('.responsive').slick({
dots: true,
infinite: false,
speed: 300,
slidesToShow: 4,
slidesToScroll: 4,
responsive: [
{
breakpoint : 1024,
settings: {
slidesToShow: 3,
slidesToScroll: 3,
infinite: true,
dots: true
}
},
{
breakpoint: 600,
settings: {
slidesToShow: 2,
slidesToScroll: 2
}
},
{
breakpoint: 480,
settings: {
slidesToShow: 1,
slidesToScroll: 1
}
}
]
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question