JQuery shows show () hides hide () toggles how to use toggle ()
This article is about how to show show () hide hide () and switch toggle () in JQuery. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Many animation effects are encapsulated in JQuery
1. Show ()
Show ([speed], [easing], [fn])
1) parameters can be omitted and directly displayed without animation.
2) speed: a string of one of the three predefined speeds ("show", "normal", or "fast") or a millisecond value representing the duration of the animation (for example, 1000).
3) easing: (Optional) is used to specify the switching effect. By default, swing can use the parameter linear.
4) fn: callback function, which runs after the animation is executed, and each element executes once.
2. Hide ()
Hide ([speed], [easing], [fn])
5) parameters can be omitted and directly displayed without animation.
6) speed: a string of one of the three predefined speeds ("show", "normal", or "fast") or a millisecond value representing the duration of the animation (for example, 1000).
7) easing: (Optional) is used to specify the switching effect. By default, swing can use the parameter linear.
8) fn: callback function, which runs after the animation is executed, once for each element.
3. Toggle ()
Toggle ([speed], [easing], [fn])
9) parameters can be omitted and directly displayed without animation.
10) speed: a string of one of the three predefined speeds ("show", "normal", or "fast") or a millisecond value representing the duration of the animation (for example, 1000).
11) easing: (Optional) is used to specify the switching effect. By default, swing can use the parameter linear.
12) fn: callback function, which runs after the animation is executed, once for each element.
Div {width: 300px; height: 200px; background-color: pink } Show hidden toggle $(function () {$("button") .eq (0) .click (function ()) { ("div") .show (1000) ); $("button") .eq (1) .click (function () {$("div"). Hide (1000 alert function () {alert (1);}) ); $("button") .eq (2) .click (function () {$("div"). Toggle (1000);}) Thank you for reading! On "JQuery shows show () hide hide () switch toggle () how to use this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, you can share it out for more people to see it!