Skip to content

Instantly share code, notes, and snippets.

@Korveld
Created February 16, 2021 12:48
Show Gist options
  • Select an option

  • Save Korveld/46a49dd85d7ea14be27d5fef53259ff7 to your computer and use it in GitHub Desktop.

Select an option

Save Korveld/46a49dd85d7ea14be27d5fef53259ff7 to your computer and use it in GitHub Desktop.
Slick prevent click on slide
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