Jquery effect-animate, toggle

Source: Internet
Author: User

The animate () method executes the Custom Animation of the CSS property set.

Syntax: $ ("divImg"). animate (Styles,Speed,Easing,Callback)

Parameter: styles is required. It specifies the CSS style and value that produce the animation effect.

Speed (optional) specifies the Animation Generation speed. The default value is normal, and the value is fast, slow, and millisecond.

Easing (optional) set the speed of different animation points (rarely used)

Callback (optional) functions executed after the animate Function

The toggle () method switches the visible state of the element.

Syntax: $ (Selector). Toggle (Speed,Callback,Switch)

Parameter: all three parameters are optional,

Switch: Boolean value. Specifies whether toggle hides or displays all selected elements. True and false. If this parameter is set, the speed and callback parameters cannot be used.

Instance:

View Code

1 <script type = "text/javascript">
2 // expand and contract
3 $ (document). ready (function (){
4 $ (". information_title"). toggle (function (){
5 $ (this). next (". information_contant"). animate ({height: 'toggle ', opacity: 'toggle'}, "slow ");
6}, function (){
7 $ (this). next (". information_contant"). animate ({height: 'toggle ', opacity: 'toggle'}, "slow ");
8 });
9 });
10 </script>
11
12 <div class = "information_title">
13
14
15 </div>
16
17 <div class = "information_contant">
18
19 </div>

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.