Stop animation stops in jquery

Source: Internet
Author: User

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


. 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)
    1. Stop (): Only the first animation is stopped, the second third one continues
    2. Stop (TRUE): Stops the first, second, and third animations
    3. 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://"></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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.