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>