Skip to content

Instantly share code, notes, and snippets.

@yuriitaran
Created September 29, 2018 20:24
Show Gist options
  • Save yuriitaran/8d98f479c438a56e1a880ac78d2870f0 to your computer and use it in GitHub Desktop.
Save yuriitaran/8d98f479c438a56e1a880ac78d2870f0 to your computer and use it in GitHub Desktop.
Slick click (touch) event inside a slide
The solution is to use event delegation (jquery's ".on()" method) from outside of the carousel's top element
(with the "slick-slider" class), targeting the elements inside the carousel.
This way the event handler is unaffected by the bug.
Example:
$('.carousel-container').on('click', 'div.button', function() {
// do stuff
});
<div class="carousel-container">
<div class="slick-slider">
...
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment