JQuery Stop Animation

Source: Internet
Author: User

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

JQuery Stop () method

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
$ (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.

The following example shows the Stop () method with no parameters:

Instance
1<! DOCTYPE html>234<script src= "/jquery/jquery-1.11.1.min.js" ></script>5<script>6$ (document). Ready (function(){7$ ("#flip"). Click (function(){8$ ("#panel"). Slidedown (5000);9   });Ten$ ("#stop"). Click (function(){ One$ ("#panel").stop (); A   }); - }); -</script> the   -<style type= "Text/css" > - #Panel, #flip - { +Padding5px; -Text-align:Center; +Background-color:#E5EECC; ABorder:solid 1px#c3c3c3; at } - #Panel - { -Padding50px; -Displaynone; - } in</style> - to  +<body> -   the<button id= "Stop" > Stop sliding </button> *<div id= "Flip" > Click here to slide the panel down </div> $<div id= "Panel" >hello world!</div>Panax Notoginseng  -</body> theView CodeView results:

Default effect:

Click to swipe, and then point to stop:

Click on the slide again:

JQuery Stop Animation

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: 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.