jquery Hide and display effect implementation _jquery

Source: Internet
Author: User

Instance

JQuery Hide ()

Simple jquery Hide () method demo.

JQuery Hide ()

Another hide () instance. Demonstrates how to hide text.

JQuery Hide () and show ()

With JQuery, you can use the Hide () and show () methods to hide and display HTML elements:

Instance

$ ("#hide"). Click (function () {
$ ("P"). Hide ();
});
$ ("#show"). Click (function () {
$ ("P"). Show ();
});

Grammar:

$ (selector). Hide (speed,callback);
$ (selector). Show (Speed,callback);

Optional speed parameters Specify the hidden/displayed speed, which can take the following values: "Slow", "fast", or milliseconds.

The optional callback parameter is the name of the function that was executed after the hide or display was completed.

The following example shows the Hide () method with the speed parameter:

Instance

$ ("button"). Click (function () {
$ ("P"). Hide (1000);
});

JQuery Toggle ()

With JQuery, you can use the toggle () method to toggle the Hide () and show () methods.

Displays the elements that are hidden and hides the displayed elements:

Instance

$ ("button"). Click (function () {
$ ("P"). Toggle ();
});

Grammar:

$ (selector). Toggle (Speed,callback);

Optional speed parameters Specify the hidden/displayed speed, which can take the following values: "Slow", "fast", or milliseconds.

The optional callback parameter is the name of the function that was executed after the toggle () method was completed.

Related Article

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.