M
M
MegaPuxapb2020-01-15 01:02:51
JavaScript
MegaPuxapb, 2020-01-15 01:02:51

Slider Syncing for multiple sliders?

There are several similar synchronized sliders on the page (Slider Syncing). With the same classes: .slider-for and .slider-nav.
Of course, when you scroll through one, the rest scroll through.
how to fix?

$('.slider-for').slick({
  slidesToShow: 1,
  slidesToScroll: 1,
  arrows: false,
  fade: true,
  asNavFor: '.slider-nav'
});
$('.slider-nav').slick({
  slidesToShow: 3,
  slidesToScroll: 1,
  asNavFor: '.slider-for',
  dots: true,
  centerMode: true,
  focusOnSelect: true
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2020-01-15
@MegaPuxapb

Initialize each pair of sliders individually:

$('селектор контейнеров пар слайдеров').each(function() {
  $('.slider-for', this).slick({
    ...
    asNavFor: $('.slider-nav', this),
  });

  $('.slider-nav', this).slick({
    ...
    asNavFor: $('.slider-for', this),
  });
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question