D
D
DeniSidorenko2019-10-14 13:36:46
JavaScript
DeniSidorenko, 2019-10-14 13:36:46

How to scroll through the sliders one by one?

There are 5 sliders (initialized at the same time, as a common class):

$('.custom-photos__slides').slick({
    slidesToShow: 1,
    slidesToScroll: 1,
    arrows: false,
    dots: false,
  })


The question is how to make such functionality: the slide of the first slider changes, a second passes, the slide of the second slider changes, a second passes, the slide of the third slider changes, and so on. And when it comes to the last slide, it starts over.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2019-10-14
@DeniSidorenko

let slider = -1;

setInterval(() => {
  slider = (slider + $sliders.length + 1) % $sliders.length;
  $sliders.eq(slider).slick('slickNext');
}, 1000);

https://jsfiddle.net/s3z5mw7h/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question