does anyone know how to add an additional “Next slide” button to a Slick Slider? I am already using the dots, and the previous & next arrows, but on the first slide I need to add an additional “Next Slide Button” (for design purposes). Suggestions…help…
Basically a button that advances to the next slide (so on tab-slick-index=”0″ go to tab-slick-index=”1″). This button would only show on the first slide.
Advertisement
Answer
Check out the https://kenwheeler.github.io/slick/ Methods section.
Possible Solution
Add your button <button id="nextSlideBtn">Next Slide Button</button>
inside the first slide.
ES6
JavaScript
x
8
1
const button = document.getElementById('nextSlideBtn');
2
const nextSlide = (slider) => {
3
$(slider).slick('slickNext');
4
};
5
button.addEventListener('click', () => {
6
nextSlide(<YOUR SLIDER>);
7
});
8
ES5
JavaScript
1
8
1
var button = document.getElementById('nextSlideBtn');
2
var nextSlide = function nextSlide(slider) {
3
$(slider).slick('slickNext');
4
};
5
button.addEventListener('click', function () {
6
return nextSlide(<YOUR SLIDER>);
7
});
8