jquery effect Slidetoggle () method (toggle between hide and display) _jquery

Source: Internet
Author: User
Instance
Toggle the <p> element between display and hidden states by using the slide effect:
Copy Code code as follows:

$ (". Btn1"). Click (function () {
$ ("P"). Slidetoggle ();
});


Definitions and usage
The Slidetoggle () method toggles the visible state of an element by using a sliding effect (height change).

If the selected element is visible, the elements are hidden, and if the selected element is hidden, the elements are displayed.

Grammar
$ (selector). Slidetoggle (speed,callback) parameter description
Speed Optional. Specify the speed (or vice versa) from which elements are hidden to visible. The default is "normal".

Possible values:

Milliseconds (for example, 1500)
"Slow"
"Normal"
"Fast"
In the case of setting the speed, the element will gradually change its height during the switching process (this will create a sliding effect).

Callback optional. The function to execute after the toggle function has finished executing.

For more information on callback, please visit our JQuery callback chapter.

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


Tips and comments
Tip: If the element is already hidden, the effect does 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.