toggle () event It mainly toggles the visible state of the element, here is a introduction to the use of jquery toggle implementation of the Web page loading completed automatic window
Toggle () Event It mainly toggles the visible state of the element. 1, toggle (switch) ①switch is an optional value, if not filled, the original element is displayed to hide it, if it is hidden display. HTML code: code as follows: <p>hello</p><p style= "Display:none" >hello again</p>& nbsp JQuery Code: code is as follows: $ ("P"). Toggle () Results: code is as follows: <p tyle= "Display:none" >Hello< /p><p style= "Display:block" >hello again</p> ②switch If a value is true or FALSE, the element is displayed if it is true. False to hide elements. html code as follows: <p ID = "tt" >Hello</p> <input type= "button" value= "transform" id= "B" > &nbs P The jquery code is as follows: var i = 0; $ ("#b"). Click (function () { $ ("#tt"). Toggle (i++%2==0); }); 2, Toggle (speed, [callback]) speed is an optional parameter that represents the speed of the animation of the element, which is displayed or hidden by the "slide" of the animation, and its value can be made (slow, normal, fast); [Callback] Is the method that the function can execute. HTML code code as follows: <p style= "display:none" id = "T" >hello again</p> jquery code The code is as follows: $ ("#t"). Toggle ("Slow", function () { alert ("123456 "); }); that is: When using the second method, the hidden speed can be loaded on the Web page automatically screen