K
K
kentos2019-02-14 19:33:37
JavaScript
kentos, 2019-02-14 19:33:37

How to make slide tracking?

I use slick slider, elements are used as navigation buttons . How do I add the active-link class to the corresponding element when changing the slide? Tried to implement like this:<a class="no-active></a>

$('.menu-slider').on('afterChange', function(event, slick, currentSlide, nextSlide){
        $('.no-active').removeClass('active-link');
        currentSlide = $('.no-active').addClass('active-link');
    });


But they are assigned to everyone.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2019-02-14
@kentos

$('.menu-slider').on('afterChange', function(event, slick, currentSlide) {
  $('.no-active').removeClass('active-link').eq(currentSlide).addClass('active-link');
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question