T
T
Tony C.2016-03-11 01:48:00
JavaScript
Tony C., 2016-03-11 01:48:00

Slick, how to determine the direction of flipping sliders?

Hello!
Tell me, how can I determine the direction in which the user flips through the slides (left to right or right to left) in a slick? What it is for: the animation of the slide content is set up, and when flipping back, you need to set the animation in the opposite direction :)
Thank you in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Murat Atila, 2016-03-11
@TheExplay

Everything is written in the api in the
dock
Read the section Events

// On swipe event
$('.your-element').on('swipe', function(event, slick, direction){
  console.log(direction);
  // left
});

// On edge hit
$('.your-element').on('edge', function(event, slick, direction){
  console.log('edge was hit')
});

// On before slide change
$('.your-element').on('beforeChange', function(event, slick, currentSlide, nextSlide){
  console.log(nextSlide);
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question