JQuery Effect-HiddenHide ()and displayShow ()
Grammar:
$(
selector).Hide(
Speed,callback);
$(
selector).Show(
Speed,callback);(optional) speed parameter: Ruleshidden/displayed speed, you can take the following values: "Slow", "fast", or milliseconds.(optional) callback parameters: Is hidden or displayed after the completion of theFunction Name。 Example 1: Use the Hide () and show () methods to hide and display HTML elements:
<script>$ (document). Ready (function() { $ ("#hide"). Click (function () { $ ("P"). Hide (); }); $ ("#show"). Click (function() { $ ("P"). Show (); });}); </script><body> <p> If you click on the "Hide" button, I will disappear. </p> <button id= "Hide" > Hide </button> <button id= "Show" > Show </button></ Body>
Example 2: Show the Hide () and show () methods with the speed parameter:
<script>$ (document). Ready (function() { $ ("#hide"). Click (function () { $ ("P"). Hide (+); }); $ ("#show"). Click (function() { $ ("P"). Show (+); });}); </script><body><button id= "Hide" > Hide </button><button id= "Show" > Show </button> <p> This is a paragraph, the content is relatively small. </p><p> This is another small paragraph </p></body>
Toggle () Method: To toggle the Hide () and show () methods
Example 3: Show the hidden elements and hide the displayed elements:
<script>$ (document). Ready (function() { $ ("button"). Click (function () { $ ("P"). Toggle (); }) ; </script><body><button> Hide/Show </button><p> This is a text paragraph. </p><p> This is another text paragraph. </p></body>
JQuery Effect-Fade injQuery fadeIn ()Fade OutFadeOut ()
JQuery Learning 02--Effects: Hide/show, fade, swipe, animate, stop animation, Callback, chain