How do I stop an effect in jQuery

后端 未结 4 1625
Happy的楠姐
Happy的楠姐 2020-12-17 16:39

I have a page that uses

$(id).show(\"highlight\", {}, 2000);

to highlight an element when I start a ajax request, that might fail so that

4条回答
  •  执念已碎
    2020-12-17 16:44

    From the jQuery docs:

    http://docs.jquery.com/Effects/stop

    Stop the currently-running animation on the matched elements....

    When .stop() is called on an element, the currently-running animation (if any) is immediately stopped. If, for instance, an element is being hidden with .slideUp() when .stop() is called, the element will now still be displayed, but will be a fraction of its previous height. Callback functions are not called.

    If more than one animation method is called on the same element, the later animations are placed in the effects queue for the element. These animations will not begin until the first one completes. When .stop() is called, the next animation in the queue begins immediately. If the clearQueue parameter is provided with a value of true, then the rest of the animations in the queue are removed and never run.

    If the jumpToEnd argument is provided with a value of true, the current animation stops, but the element is immediately given its target values for each CSS property. In our above .slideUp() example, the element would be immediately hidden. The callback function is then immediately called, if provided...

提交回复
热议问题