Привет, мне нужно обратиться к последнему слайду slick slider`а.
Есть такой код
$(document).ready(function(){
$(function carouselSetup() {
var $componentCarousel = $('.menu-content1'),
$items = $componentCarousel.find('.carousel-item');
var $slick = $componentCarousel.slick({
infinite: false,
speed: 500,
draggable: true,
slidesToShow: 3,
slidesToScroll: 3,
prevArrow: '<button type="button" class="slick-prev">prev</button>',
nextArrow: '<button type="button" class="slick-next">next</button>'
});
var $prevButton = $slick.find('.slick-prev');
var $nextButton = $slick.find('.slick-next');
$prevButton.hide();
$slick.on('beforeChange', function(event, slick, currentSlide, nextSlide) {
//console.log(nextSlide);
if (nextSlide === 0) {
$prevButton.hide();
}
if (nextSlide === slick.slideCount - 1) {
$nextButton.hide();
}
if (currentSlide === 0) {
$prevButton.show();
}
if (currentSlide === slick.slideCount - 1) {
$nextButton.show();
}
});
});
});