I’m trying to build a slideshow using jquery. The animation for the next image to rotate takes 1 second and the slider also has next and prev controls.
Is it possible to block the next and prev control to fire while the animation is ongoing?
I’m trying to build a slideshow using jquery. The animation for the next image
Share
Use a global variable (e.g.
var animating = false) to indicate the status of animation.Set it to
truewhen animation begins, and set it tofalsewhen animation ends (in the callback function).In the
prevandnextfunctions, just checkanimating. If it is true, do nothing except return.