...

Library - JQuery

Back to Course

Lesson Description


Lession - #563 JQuery Stop()


The jQuery stop(>
method is used to prevent an animation or effect before it's finished. The stop(>
technique works for all jQuery effect functions, including sliding, fading and custom animations.

Syntax

$(selector>
.stop(stopAll,goToEnd>


Parameter Description
stopAll Optional.
A boolean value specifying whether or not or not to stop the queued animations as well. Default is false

goToEnd Optional.
A boolean value specifying whether or not to complete all animations immediately. Default is false

Example


<html>  
<head> 
 <title> jQuery Example</title>  
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">  
 <script>  
 $(document>
.ready(function(>
{ $("#start">
.click(function(>
{ $("div">
.animate({height: 300}, 3000>
; $("div">
.animate({width: 300}, 3000>
; }>
; $("#stop">
.click(function(>
{ $("div">
.stop(>
; }>
; }>
; </script> </head> <body> <p> <button id="start">Start Animation</button> <button id="stop">Stop Current Animation</button> </p> <div style="background:blue;height:100px;width:100px"></div> </body> </html>
Try it here