jquery: Animated Selector usage instance _jquery

Source: Internet
Author: User

The example in this article describes jquery: animated selector usage. Share to everyone for your reference. The specific analysis is as follows:

This selector matches all elements that are performing an animation effect.
You can use the animate () method to create a custom animation.

Syntax structure:

Copy Code code as follows:
$ (": animated")

This selector is typically used in conjunction with other selectors, such as the class selector and the element selector, and so on. For example:
Copy Code code as follows:
$ ("li:animated"). CSS ("Background-color", "Blue")

The above code sets the background color of the LI element under which the animation is being performed to blue.
If you do not use it with other selectors, the default state is to use with the * selector, for example $ (": Animated") equals $ ("*:animated").

Instance code:

Copy Code code as follows:

<! DOCTYPE html>
<meta charset= "Utf-8" >
<meta name= "Author" content= "http://www.jb51.net/"/>
<title> Cloud-dwelling community </title>
<style type= "Text/css" >
li{
List-style-type:none;
width:150px;
height:30px;
}
. Run{background-color:green;}
. Static{background-color: #603;}
</style>
<script type= "Text/javascript" src= "Mytest/jquery/jquery-1.8.3.js" ></script>
<script type= "Text/javascript" >
$ (document). Ready (function () {
function Runit () {
$ (". Run"). Animate ({width: "250px"});
$ (". Run"). Animate ({width: "150px"},runit);
}
$ ("button"). Click (function () {
Runit ();
$ ("li:animated"). CSS ("Background-color", "Blue");
})
})
</script>
<body>
<ul>
<li class= "Run" ></li>
<li class= "Static" ></li>
</ul>
<button> Click to start animation </button>
</body>

You can set the background color of an animation element to blue.

I hope this article will help you with your jquery programming.

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.