JQuery Stop Animation-jquery Stop ()

Source: Internet
Author: User

The JQuery Stop () method is used to stop animations or effects before they are finished.

The Stop () method applies to all JQuery effect functions, including sliding, fading, and custom animations.

Grammar:

1 $ (selector). Stop (stopall,gotoend);

The optional StopAll parameter specifies whether the animation queue should be cleared. The default is false, which stops only active animations, allowing any queued animation to be executed backwards.
The optional gotoend parameter specifies whether to complete the current animation immediately. The default is False.
Therefore, by default, stop () clears the current animation specified on the selected element.

Example:

1 <!DOCTYPE HTML>2 <HTML>3 <Head>4 <Scriptsrc= "Jquery-2.2.0.min.js">5 </Script>6 <Script> 7 $ (document). Ready (function(){8   $("#start"). Click (function(){9     $("Div"). Animate ({left:'100px'}, the);Ten     $("Div"). Animate ({fontSize:'3em'}, the); One   }); A    -   $("#stop"). Click (function(){ -     $("Div"). Stop (); the   }); -  -   $("#stop2"). Click (function(){ -     $("Div"). Stop (true); +   }); -  +   $("#stop3"). Click (function(){ A     $("Div"). Stop (true,true); at   }); -    - }); - </Script>  - </Head> - <Body> in  - <ButtonID= "Start">Begin</Button> to <ButtonID= "Stop">Stop it</Button> + <ButtonID= "Stop2">Stop all</Button> - <ButtonID= "STOP3">Stop but to complete</Button> the <P><b>Start</b>The button will start the animation.</P> * <P><b>Stop</b>The button stops the currently active animation, but allows the queued animation to be executed forward.</P> $ <P><b>"Stop All"</b>button to stop the currently active animation and empty the animation queue, so all animations on the element will stop.</P>Panax Notoginseng <P><b>"Stop but do it"</b>Immediately completes the animation of the current activity and then stops.</P>  -  the <Divstyle= "background: #98bf21; height:100px;width:200px;position:absolute;">HELLO</Div> +  A </Body> the </HTML>

JQuery Stop Animation-jquery Stop ()

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: info-contact@alibabacloud.com 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.