jQuery stop animation
jQuery stop() method
jQuery stop() method is used to stop animations or effects before they are completed.
The stop() method works with all jQuery effect functions, including slides, fades, and custom animations.
Syntax:
$(selector).stop(stopAll,goToEnd);
The optional stopAll parameter specifies whether the animation queue should be cleared. The default is false, which stops only active animations and allows any queued animations to execute backwards.
The optional goToEnd parameter specifies whether to complete the current animation immediately. The default is false.
So, by default, stop() will clear the current animation specified on the selected element.
The following example demonstrates the stop() method without parameters:
点我向下滑动面板我们必须接受失望,因为它是有限的,但千万不可失去希望,因为它是无穷的
Run the program to try it
jQuery stop() animation (With parameters)
点击 "开始" 按钮开始动画。
点击 "停止" 按钮停止当前激活的动画,但之后我们能再动画队列中再次激活。
点击 "停止所有" 按钮停止当前动画,并清除动画队列,所以元素的所有动画都会停止。
点击 "停止动画,但完成动作" 快速完成动作,并停止它。
HELLO
Run the program and try it