Answer the question
In order to leave comments, you need to log in
How to add a class to the generated slider element?
I have pug markup like this.
.slider_right_wrap
.slider_right
.slider_right_item.no_opacity
.slider_right_item_content
.slider_right_item
.slider_right_item_content
.slider_right_item
.slider_right_item_content
.nav_for_slider
.arrow_slider.arrow_left
.arrow_slider.arrow_right
$('.slider_right').slick({
slidesToShow: 2,
slidesToScroll: 1,
});
$('.slider_left').slick({
infinite: true,
speed: 500,
fade: true,
cssEase: 'linear'
});
$('.arrow_right').on('click', function() {
$('.slider_right').slick('slickNext');
let selected_item = $('.slider_right').find('.opacity');
selected_item.removeClass('opacity');
selected_item.next().addClass('opacity');
});
$('.arrow_left').on('click', function() {
$('.slider_right').slick('slickPrev');
let selected_item = $('.slider_right').find('.opacity');
selected_item.removeClass('opacity');
selected_item.prev().addClass('opacity');
});
Answer the question
In order to leave comments, you need to log in
Use:
$('.your-element').on('beforeChange', function(event, slick, currentSlide, nextSlide){
console.log(nextSlide);
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question