JQuery Learning 02--Effects: Hide/show, fade, swipe, animate, stop animation, Callback, chain

Source: Internet
Author: User

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

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.