-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmy-carousel-script.js
42 lines (40 loc) · 1.17 KB
/
my-carousel-script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
window.__forceSmoothScrollPolyfill__ = true;
jQuery(document).ready(function($) {
var $carousel = $('.my-carousel'); // Define $carousel variable
// Initialize the carousel
$carousel.slick({
slidesToShow: 3,
slidesToScroll: 1,
autoplay: false,
speed: 500,
cssEase: 'linear',
dots: true, //Dot Navigation
arrows: false, // remove arrow nav
responsive: [
{
breakpoint: 960,
settings: {
slidesToShow: 2,
slidesToScroll: 1,
}
},
{
breakpoint: 670,
settings: {
slidesToShow: 1,
slidesToScroll: 1
}
}
]
});
// Hide dots if there's only one page
$carousel.on('init', function(event, slick) {
setTimeout(function() {
var slideCount = $carousel.slick('getSlick').slideCount;
var slidesToShow = $carousel.slick('getSlick').options.slidesToShow;
if (slideCount <= slidesToShow) {
$carousel.find('.slick-dots').hide();
}
}, 0);
});
});