JQuery effect slideToggle () method (switching between hiding and display) _ jquery-js tutorial

Source: Internet
Author: User
The slideToggle () method uses the sliding effect (height change) to switch the visible state of the element. Instance
Switch between the display and hide states by using the sliding effect

Element:

The 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.
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.