Near graduation, is writing a graduation work, through the work to learn the jquery framework.
Toggle () Method:
Toggles the visible state of the element.
If the selected element is visible, the elements are hidden and displayed if the selected element is hidden.
Grammar
$ (selector). Toggle (Speed,callback,switch)
Parameters |
Description |
Speed |
Optional. Specifies that the element is visible to the hidden speed (or vice versa). The default is "0". Possible values:
- milliseconds (e.g. 1500)
- "Slow"
- "Normal"
- "Fast"
In the case of setting the speed, the element gradually changes its height, width, margin, padding, and transparency as it is visible to the hidden process. If you set this parameter, you cannot use the switch parameter. |
Callback |
Optional. The function to execute after the toggle function finishes executing. To learn more about callback, please visit our JQuery callback chapter. This parameter cannot be set unless the speed parameter is set. |
Switch |
Optional. Boolean value. Specifies whether toggle hides or displays all selected elements.
- True-Show all elements
- False-Hides all elements
If this parameter is set, the speed and callback parameters cannot be used. |
Hints and Notes
Note: This effect applies to elements that are hidden through jQuery, or that display:none elements are declared in CSS (but not for visibility:hidden elements).
W3 website Link: http://www.w3school.com.cn/jquery/effect_toggle.asp
Toggle () method in jquery