Answer the question
In order to leave comments, you need to log in
How can I add a class to a specific slide when the page has finished loading?
Hello. There is a code that adds a certain class to the 3rd active slide when the slide state changes:
on('changed.owl.carousel', function(property) {
var item = $('.owl-item');
var current = property.item.index;
var last = current+2;
$('.owl-item .carousel-works__item').removeClass('current');
$(property.target).find(".owl-item").eq(last).find('.carousel-works__item').addClass('current');
});
$('.carousel-works').owlCarousel().on('initialize.owl.carousel', function() {
var item = $('.owl-item');
var current = property.item.index;
var last = current+2;
$(property.target).find(".owl-item").eq(last).find('.carousel-works__item').addClass('current');
}).on('changed.owl.carousel', function(property) {
var item = $('.owl-item');
var current = property.item.index;
var last = current+2;
$('.owl-item .carousel-works__item').removeClass('current');
$(property.target).find(".owl-item").eq(last).find('.carousel-works__item').addClass('current');
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question