A simple example of jQuery animation effect

Source: Internet
Author: User

I. Reasons for Demand
Currently, jQuery is a mature framework, and there are hundreds of plug-ins Based on it. In this example, I use jQuery to implement an animation effect manually.

II. Specific implementation
Copy codeThe Code is as follows:
<! DOCTYPE html PUBLIC "-// W3C // DTDHTML 4.01 Transitional //" http://www.w3.org/TR/html4/loose.dtd ">
<Html>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8">
<Title> jQuery implements animation effects </title>
<Script language = "JavaScript" src = "../jQuery/jquery-1.7.1.min.js"> </script>
<Style type = "text/css">
# Test {
Position: relative;
Width: 100px;
Height: 100px;
Border: 1px solid #0050d0;
Background: #96e555;
Cursor: pointer;
}
</Style>
<Script type = "text/javascript">
$ (Function (){
$ ("# Test" pai.css ("optcity", "0.5"); // Set opacity
$ ("# Test"). click (function (){
$ (This). animate ({left: "400px", height: "200px", opacity: "1"}, 300)
. Animate ({top: "200px", width: "200px"}, 300)
. FadeOut ("slow ");
});
});
</Script>
</Head>
<Body>
<Div id = "test"> </div>
</Body>
</Html>

Iii. Running results

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.