Slick: How to get direction of slide change?

Created on 3 Jun 2016  路  2Comments  路  Source: kenwheeler/slick

Im trying to get the direction of the slide change via beforeChange Event.

When I try to get the value from
slick.direction
or
slick.currentDirection
the value doesn't change when i click the slick arrows - currentDirection changes when i change the slide via touchmove.

Is this a bug? Or does anybody knows a better way to get the direction?

On the change i wanna add a class to the current and the prev / next slide for a custom effect.

Heres a Pen where you can see the issue on the console output ...
http://codepen.io/anon/pen/qNdqLL

Not A Bug Question / Support

Most helpful comment

hey @Skinwalker look at this solution http://codepen.io/howtomake/pen/RVReKa

All 2 comments

Hey @Skinwalker. Those keys are only used for swipe and if infinite is false and autoplay is true--I can see how it's a little confusing. The only way I know of is to compare the value of the previous slide to the next slide, with special attention paid to infinite transitions. Hope that helps!

hey @Skinwalker look at this solution http://codepen.io/howtomake/pen/RVReKa

Was this page helpful?
0 / 5 - 0 ratings