Answer the question
In order to leave comments, you need to log in
Why doesn't the attribute value change?
This code always outputs 0 even though the slides are switched and the "slick-current" class is reassigned to other slides?
There are five slides and the data attributes go from 0 to 4.
$('.content-inn').on('afterChange', function(){
console.log($(".slick-active").attr('data-slick-index'));
})
Answer the question
In order to leave comments, you need to log in
You don't need to go into the attributes, the afterChanges event already has the index of the current slide in its arguments
$('.content-inn').on('afterChange', function(event, slick, currentSlide){
console.warn(currentSlide);
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question