Saturday, 26 March 2016

How jQuery stop() method is useful ?


jQuery stop() method

Stops an animation or effect before it is finished.
The stop() method works for all jQuery effect functions, including sliding, fading and custom animations.

SYNTAX
$(selector).stop(stopAll,goToEnd);

stopAll - specifies whether also the animation queue should be cleared or not.
   [Default is false, which means that only the active animation will be stopped, allowing any queued animations to be performed afterwards.]

goToEnd - specifies whether or not to complete the current animation immediately. Default is false.
By default, the stop() method kills the current animation being performed on the selected element.

Example
$("#stop").click(function() {
  $("#panel").stop();
});

No comments:

Post a Comment

Note: only a member of this blog may post a comment.