[jquery Programming Challenge]001: Implement page element Acceleration animation effect

Source: Internet
Author: User

Requirements:

    • page contains two HTML elements: a button, a small square
    • Animation requirements: Click the button, the small square from the page coordinates 300,300, accelerate the move to 0,0
Relevant knowledge points:
    • jquery Animation Method Animate
    • Setting of the easing parameter

  

<!DOCTYPE HTML><HTMLLang= "zh">    <Head>        <MetaCharSet= "Utf-8">        <title>Implement page element Acceleration animation effect</title>        <styletype= "Text/css">. BTN{Border:1px solid #fff;Border-radius:4px;Background-color:#5cb85c;width:60px;Height:30px;Line-height:30px;text-align:Center;Color:#fff;cursor:Pointer;            }. Btn:hover{Background-color:#449D44;            }. Ball{position:Absolute; Left:10px;Top:60px;Background-color:#337AB7;width:50px;Height:50px;Border-radius:50px;            }        </style>        <Scripttype= "Text/javascript"src= "Jquery-1.11.0.js"></Script>        <Scripttype= "Text/javascript"src= "Jquery.easing.1.3.js"></Script>        <Scripttype= "Text/javascript">            $(function() {                var$div= $('. BTN'), $ball= $('. Ball'); $div. On ('Click', function() {$ball. Animate ({left:'200px', Top:'200px'}, 'Slow', 'jswing');        })            }); </Script>    </Head>    <Body>        <Divclass= "BTN">Begin</Div>        <Divclass= "Ball"></Div>    </Body></HTML>

[jquery Programming Challenge]001: Implement page element Acceleration animation effect

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.