jquery stop animation, jquery Callback function, jquery-chaining

Source: Internet
Author: User

First, JQuery stop animation

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.

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

<Scriptsrc= "Jquery-1.11.1.min.js"></Script><Script>    $(function(){        $("#flip"). Click (function(){            $("#panel"). Slidedown ( the);          }); $("#stop"). Click (function(){            $("#panel"). Stop ();    }); });</Script><styletype= "Text/css">#panel, #flip{padding:5px;text-align:Center;Background-color:#e5eecc;Border:Solid 1px #c3c3c3;}#panel{padding:50px;Display:None;}</style></Head><Body>    <ButtonID= "Stop">Stop sliding</Button>    <DivID= "Flip">Click here to slide down the panel</Div>    <DivID= "Panel">Hello world!</Div></Body>

JQuery Stop () animation (with parameters)

<Scriptsrc= "Jquery-1.11.1.min.js"></Script><Script>    $(function(){        $("#start"). Click (function(){            $("Div"). Animate ({left:'100px'}, the); $("Div"). Animate ({fontSize:'3em'}, the);        }); $("#stop"). Click (function(){            $("Div"). Stop ();          }); $("#stop2"). Click (function(){            $("Div"). Stop (true);          }); $("#stop3"). Click (function(){            $("Div"). Stop (true,true);    }); });</Script><styletype= "Text/css">#panel, #flip{padding:5px;text-align:Center;Background-color:#e5eecc;Border:Solid 1px #c3c3c3;}#panel{padding:50px;Display:None;}</style></Head><Body>    <ButtonID= "Start">Begin</Button>    <ButtonID= "Stop">Stop it</Button>    <ButtonID= "Stop2">Stop all</Button>    <ButtonID= "STOP3">Stop but to complete</Button>    <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>    <P><b>"Stop but do it"</b>Immediately completes the animation of the current activity and then stops.</P>     <Divstyle= "background: #98bf21; height:100px;width:200px;position:absolute;">HELLO</Div></Body>

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.