How can I add the Next/Prev buttons on the pagination of Slick? On my first try, I tried to load the slick table and append the next and prev buttons on the pagination div
. It successfully appended the button, but the buttons were static. They function when I click on them. My next attempt was to append the next and prev buttons using jQuery, then initialize the slick slider. The problem with this is the buttons were not appended.
-This is my loadSlider
function:
loadSlider: function(_this) {
$(document).ready(function() {
$(_this.widgetClass + '.custom-slick').slick({
dots: true,
infinite: false,
speed: 300,
slidesToShow: 4,
slidesToScroll: 4,
customPaging: function(slider, i) {
var thumb = $(slider.$slides[i]).data();
return '<a>' + (i + 1) + '</a>';
},
nextArrow: $('.nextPage'),
prevArrow: $('.previousPage'),
responsive: [{
breakpoint: 1024,
settings: {
slidesToShow: 3,
slidesToScroll: 3,
infinite: false,
dots: true
}
}, {
breakpoint: 600,
settings: {
slidesToShow: 2,
slidesToScroll: 2
}
}, {
breakpoint: 480,
settings: {
slidesToShow: 1,
slidesToScroll: 1
}
}]
});
});
}
-My First Attempt
_this.loadSlider(_this);
$(_this.widgetClass + '.custom-slick .slick-dots').prepend('<li><a href="#" aria-label="Previous" class="prevPage"><span aria-hidden="true">«</span></a></li>');
$(_this.widgetClass + '.custom-slick .slick-dots').append('<li><a href="#" aria-label="Next" class="nextPage"><span aria-hidden="true">»</span></a></li>');
And this is my second attempt:
$(_this.widgetClass + '.custom-slick .slick-dots').prepend('<li><a href="#" aria-label="Previous" class="prevPage"><span aria-hidden="true">«</span></a></li>');
$(_this.widgetClass + '.custom-slick .slick-dots').append('<li><a href="#" aria-label="Next" class="nextPage"><span aria-hidden="true">»</span></a></li>');
_this.loadSlider(_this);
Thanks for all your replies.
Image of what I am trying to accomplish: