S
S
Shillkas112019-03-10 12:58:56
JavaScript
Shillkas11, 2019-03-10 12:58:56

Loading new slides in Slick via ajax?

Hello. There are two related slick sliders, the bottom line is that initially, when the page is loaded, they should contain 10 slides, but when scrolling, for example, up to 9 slides, another 10 slides should be loaded into both sliders, etc. (Sorry for the tautology :))
Is it possible to implement this in slick, and how?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2019-03-10
@Shillkas11

Hang the afterChange event handler, inside which you check the number of the current slide. If necessary, add new slides using the slickAdd method:

$slick.on('afterChange', function(e, slick, slide) {
  if (slide какой надо) {
    $(this).slick('slickAdd', новыеСлайды);
  }
});

https://jsfiddle.net/3afrdcm/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question