This example implements a tree-shaped dynamic menu, compatible with IE8, Firefox, Chrome and other browsers. The toggle () method of jquery is used. The effect and code are as follows:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
This example uses the toggle () method of jquery, which is described below:
Definitions and usage
The toggle () method Toggles the visible state of the element.
If the selected element is visible, the elements are hidden, and those elements are displayed if the selected element is hidden.
Grammar
$ (selector). Toggle (Speed,callback,switch)
Tips and comments
Note: This effect applies to elements that are hidden through jQuery, or elements that declare display:none in CSS (but not for visibility:hidden elements).
The above is the jquery implementation of the tree menu complete code, I hope that the learning jquery program to help.