amy
amy

Reputation: 81

How to detect the last slide and first slide in slick?

I am trying to detect the first slide and last slide using slick.js.https://github.com/kenwheeler/slick How can I do that?

Upvotes: 1

Views: 6330

Answers (1)

Fiido93
Fiido93

Reputation: 1978

There is couple of events you can use to detect this:

beforeChange

$('.slider').on('beforeChange', function(event, slick, currentSlide, nextSlide){
  console.log(nextSlide);
});

afterChange

$('.slider').on('afterChange', function(event, slick, currentSlide){
  console.log(currentSlide);
});

swipe

$('.slider').on('swipe', function(event, slick, direction){
  console.log(direction);
  // left
});

Let me know if this works for u.

Thanks

Upvotes: 2

Related Questions