I have a carousel, and I click events that are tied to the navigation arrows. When they are clicked, I use jQuery animation to animate in the elements of the next carousel slide, and due to the nature of the animations I use several times setTimeout().
I have one error where, if I click on the arrow and then quickly click on the previous or next arrow, the animation gets confused due to timeouts (which are necessary in this project) and does not display anything on the screen. I have been looking at this for a while, and I believe that the best way might be to prevent other arrows from being pressed until the current animation is complete.
Each arrow is controlled by clicknot on:('click', function() ..., etc .:
$("#arrow1").click(function() {...}
I watched
$("element").off("click");
But since they are not bound using the 'on' method, I don't think this will work.
I need something like:
$("#arrow1").click(function() {
$("#arrow2, #arrow3, #arrow4").off("click");
$("#arrow2, #arrow3, #arrow4").on("click");
}
But I have not yet been able to get this to work.
source
share