Custom Animation Methods Animate

Source: Internet
Author: User

How animate is used: Animate (Params,speed,callback);

Example: Animate ({right: "-=600px", Height: "+=400px"}, "slow", function () {$ (this). CSS ("Border", "5px Solid Red")});

where right and left , height change, width change.

+ = indicates the current position to left/right or add height/width to xx pixels. "Slow" means speed, and it can make its own time, 3000 means 3000 milliseconds.

The last one is to return the function, which represents the action to take after the animation is finished.

Example code, a div box with an ID of block, moves it to the right by 600px, and increases the height by 400px.

<!DOCTYPE HTML><HTMLLang= "en"xmlns= "http://www.w3.org/1999/xhtml"><Head>    <MetaCharSet= "Utf-8" />    <Scriptsrc= "Jquery-1.3.2.min.js"></Script>    <Linkhref= "Style.css"rel= "stylesheet"type= "Text/css" />    <Script>$ (document). Ready (function () {            $("#block"). Click (function () {                $( This). Animate ({right:"-=600px", Height:"+=400px" }, "Slow", function () { $( This). CSS ("Border","5px Solid Red")});        });    }); </Script>    <style>#block{Margin-left:500px;Height:300px;width:300px;position:Absolute;Background-color:Blue;        }    </style>    <title></title></Head><Body>    <DivID= "Block"></Div></Body></HTML>

Custom Animation Methods Animate

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.