Stop animation stops in jquery
The animation is allowed to be paused during execution, when an element is called. Stop () method, the currently running animation (if any) stops immediately
Grammar:
. Stop ([Clearqueue], [Jumptoend]). Stop ([queue], [Clearqueue], [jumptoend])
Stop has a few optional parameters that can be simply said to be in these 3 cases
- . Stop (); Stop the current animation, click on the pause to continue to start
- . Stop (true); If the same element calls multiple animation methods, the animation that has not yet been executed is placed in the effect queue of the element. These animations do not start until the first one is finished. When you call. Stop (), the next animation in the queue starts immediately. If the Clearqueue parameter provides a true value, the rest of the animation in the queue is deleted and will never run
- . Stop (True,true); The current animation stops, but the CSS properties on the element are immediately modified to the target value of the animation
Simply put: Refer to the following code,
$ ("#aaron"). Animate ({ height:300}, (+) $ ("#aaron"). Animate ({ width:300}, +) $ ("#aaron"). Animate ({ opacity:0.6}, 2000)
- Stop (): Only the first animation is stopped, the second third one continues
- Stop (TRUE): Stops the first, second, and third animations
- Stop (true ture): Stops the animation and jumps directly to the final state of the first animation
<!DOCTYPE HTML><HTML><Head> <Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8" /> <title></title> <style>P{Color:Red; }Div{width:200px;Height:100px;Background-color:Yellow;Color:Red; }a{Display:Block} </style> <Scriptsrc= "Http://libs.baidu.com/jquery/1.9.1/jquery.js"></Script></Head><Body> <H2>Stop</H2> <P>MU-Class network, dedicated to share</P> <DivID= "Aaron">Internal animations</Div> <inputID= "Exec"type= "button"value= "Perform animation"><BR/><BR/>Click to observe the animation effect:<SelectID= "Animation"> <optionvalue= "1">Stop ()</option> <optionvalue= "2">Stop (true)</option> <optionvalue= "3">Stop (True,true)</option> </Select> <a></a> <inputID= "Stop"type= "button"value= "Stop animation"> <Scripttype= "Text/javascript"> //Click to perform the animation $("#exec"). Click (function(){ $("#aaron"). Animate ({height: - }, the) $("#aaron"). Animate ({width: - }, the) $("#aaron"). Animate ({opacity:0.6 }, -) }) $("#stop"). Click (function() { varv= $("#animation"). Val (); var$aaron= $("#aaron"); if(v== "1") { //Current Current animation$aaron. Stop ()}Else if(v== "2") { //Stop so queue$aaron. Stop (true) } Else if(v== "3") { //stops the animation and jumps directly to the end of the current animation$aaron. Stop (true,true) } }); </Script></Body></HTML>
Stop animation stops in jquery