kenwheeler / slick

the last carousel you'll ever need
kenwheeler.github.io/slick
MIT License
28.33k stars 5.88k forks source link

Using javascript inside of the slide causes event duplication #4192

Open HannaAugust opened 2 years ago

HannaAugust commented 2 years ago

Hello. I need to use javascript inside of my slick slide and when I do that, the js events are getting duplicated. It happens regardless 'infinite' parameter being set to 'true' or 'false'. Is there a way to use the js inside of the slide without duplication?

Thank you.

thedailycommute commented 2 years ago

I'm not 100% sure what your problem is, but a few months ago I had a duplicate event problem when adding my own click handler to the tiles within a slider. In my case I wanted to swallow the event to stop propagating, whether or not I did anything with it. Adding the following lines worked for me:

  event.stopImmediatePropagation();
  event.stopPropagation();
  event.preventDefault();
ahmadalfy commented 2 years ago

@HannaAugust can you provide a reproducible example?