Created
February 16, 2021 12:48
-
-
Save Korveld/46a49dd85d7ea14be27d5fef53259ff7 to your computer and use it in GitHub Desktop.
Slick prevent click on 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
| carousel.slick(); | |
| var isSliding = false; | |
| carousel.on('beforeChange', function() { | |
| isSliding = true; | |
| }); | |
| carousel.on('afterChange', function() { | |
| isSliding = false; | |
| }); | |
| carousel.find(".foo").click(function(e) { | |
| if (isSliding) { | |
| e.stopImmediatePropagation(); | |
| e.stopPropagation(); | |
| e.preventDefault(); | |
| return; | |
| } else { | |
| // your action on click | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment