This is the configuration I am using to create a slick carousel on my web page:
JavaScript
x
29
29
1
$('#carousel').slick({
2
infinite: true,
3
slidesToShow: 3,
4
slidesToScroll: 1,
5
arrows: true,
6
autoplay: true,
7
autoplaySpeed: 2000,
8
responsive: [
9
{
10
breakpoint: 1200,
11
settings: {
12
slidesToShow: 2,
13
slidesToScroll: 1,
14
},
15
},
16
{
17
breakpoint: 1008,
18
settings: {
19
slidesToShow: 1,
20
slidesToScroll: 1,
21
},
22
},
23
{
24
breakpoint: 800,
25
settings: 'unslick',
26
},
27
],
28
})
29
It is working the way it is supposed to work except for one thing… when I resize my browser window from width: 1920
to 800
, the carousel unslicks it, and the content is displayed like normal divs.
But then when I increase the width
of the browser window the carousel doesn’t recreate it. It remains like HTML div
blocks without carousel.
Any help would be appreciated.
Advertisement
Answer
unslick is a destructor method. Once you unslick, you need to call slick() again to construct carousel.