javascript - html collapsed/expanded tree -
I am using code to generate a tree in html, and the problem is, every time I use the tree Refresh the page to detail.
I want to make it so that when I open the page, some branches will expand and some will be stacked, it depends on that specialty.
For example:
& lt; Span & gt; & Lt; I class = "icon-plus-mark" & gt; & Lt; / I & gt; Parents 1 & lt; / Span & gt; & Lt; Ul & gt; Children go here & lt; / Ul & gt; & Lt; Span & gt; & Lt; I class = "sign-zero-sign" & gt; & Lt; / I & gt; Parents 2 & lt; / Span & gt; & Lt; Ul & gt; Children go here & lt; / Ul & gt;
When I open the page, I want to see the parents of 2 children, but not the parents.
I'm a newbie in HTML and am completely new to CSS and Javascript. Therefore any suggestion will help.
You can add the beginning of the closed code of each element mark as your icon square use Taxes collapsed
Code:
$ ('tree li.parent_li & gt; span'). Each (function (i, e) {if ($ (this) .find ('i') .hackle ("icon-plus-sign") {$ (this) .Parent ('li.parent_li'). '& Gt; ul & gt; li'). Hide ();}});
Demo:
Comments
Post a Comment