Today, I wrote a lightweight three-level expanded menu. If necessary, I can add one level. Generally, three levels of project are enough for the company. In the general management background of the company over the past few days, I used the left-side frame structure, and clicked the content on the left and right to expand the content. In the project, I often encountered Level 2 or level 3 on the left. I used dtree in the past, however, we found that dtree, style, and structure are not well controlled,
If it is dynamic data, it should also be written to the cs file and input characters, which is not conducive to maintenance and cannot be found for a long time. ,
So today I wrote a lightweight three-level expanded menu. If necessary, I can add one level. Generally, the company's three-level project is enough.
Introduction:
The p part does not need to define its own class and ID, as long as it is in the following structure, the data can be dynamic or static
You can control the style and modify it according to your own style.
The Code is as follows:
Css
The Code is as follows:
Js:
The Code is as follows: