React-slick: How to detect when slide has been swiped?

Created on 25 Sep 2017  路  4Comments  路  Source: akiran/react-slick

How can I detect when a slide has been changed through swiping on mobile? I have tried attaching a swipe event through jQuery to .slick-active but the event doesn't trigger.

$('.slick-active').on('swipe', () => {
  console.log('swipe');
});

https://jsfiddle.net/20bumb4g/4536/

Thanks!

question

Most helpful comment

Thanks for your response! I'm actually already using afterChange but for the purposes of my app, I need to determine whether a slide was changed through swiping, clicking the arrows or clicking the dots etc. Attaching a jQuery click event works fine for the arrows/dots, but for some reason the swipe event doesn't work.

All 4 comments

You can use the provided afterChange callback.
See https://jsfiddle.net/p3dn0Lwu/

Thanks for your response! I'm actually already using afterChange but for the purposes of my app, I need to determine whether a slide was changed through swiping, clicking the arrows or clicking the dots etc. Attaching a jQuery click event works fine for the arrows/dots, but for some reason the swipe event doesn't work.

We have the onSwipe event hook for that.

how to use freescrolling with react-slick?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vugman picture vugman  路  3Comments

laveesingh picture laveesingh  路  3Comments

darkalor picture darkalor  路  4Comments

quarklemotion picture quarklemotion  路  4Comments

briziel picture briziel  路  3Comments