JQuery effect slideToggle () method (switch between hide and display)

Source: Internet
Author: User

Instance
By using the slide effect, you can switch between the display and hide States <p> elements:
Copy codeThe Code is as follows:
$ (". Btn1"). click (function (){
$ ("P"). slideToggle ();
});


Definition and usage
The slideToggle () method uses the sliding effect (height change) to switch the visible state of the element.

If the selected elements are visible, these elements are hidden. If the selected elements are hidden, these elements are displayed.

Syntax
$ (Selector). slideToggle (speed, callback) parameter description
Speed is optional. Specifies the speed (or opposite) at which elements are hidden to be visible ). The default value is "normal ".

Possible values:

Millisecond (e.g. 1500)
"Slow"
"Normal"
"Fast"
When the speed is set, the height of an element changes gradually during the switching process (this will create a sliding effect ).

Callback is optional. The function to be executed after the toggle function is executed.

To learn more about callback, visit our jQuery Callback chapter.

This parameter cannot be set unless the speed parameter is set.


Tips and comments
Tip: If the element is hidden, the effect will not change unless the callback function is specified.

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.