Created
September 29, 2018 20:24
-
-
Save yuriitaran/8d98f479c438a56e1a880ac78d2870f0 to your computer and use it in GitHub Desktop.
Slick click (touch) event inside a slide
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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