标签云

微信群

扫码加入我们

WeChat QR Code

Im not an expert on JQuery so here it is. I have an HTML that looks like this:<ul class="first-class"> <li class="second-class"><a href="#_"><i class="fa fa-plus"></i></a><ul class="subdirectory-class"> <li class="second-class"><a href="#_"><i class="fa fa-plus"></i></a><ul class="subdirectory-class"> <li class="second-class"><a href="#_"> <i class="fa fa-plus"></i></a> </li></ul> </li> </ul> </li> <li class="second-class"><a href="#_"> <i class="fa fa-plus"></i></a><ul class="subdirectory-class"> <li class="second-class"><a href="#_"><i class="fa fa-plus"></i></a> </li> </ul> </li></ul>So what i would like to do, is when i press the + sign (fa fa-plus) to toggle its subdirectory. At this point, when i press the + sign all subdirectories are getting toggled. How can i rewrite this jquery code in order to achieve that? If i press the first + sign, the next, and only the next subdirectory should open. Then when i press the subdirectory, the next subdirectory should open and so on. This applies for the closing part too.JQUERY currently i have this:$(document).ready(function(){$(".first-class .second-class").click(function(e){$(".subdirectory-class", this).first().slideToggle("fast");$(this).children("a").toggleClass("closed open");e.preventDefault();});});This hides every ul accept the main one (with css display:none) and when i press on it, then it toggles all subdirectories.Any help would be very appreciated.Thanks in advance


come one thats not the point. These are finctional classes

2019年04月25日55分42秒

Mamun I don't believe there shall be a , the .first-classis the ul and the .second-class is all the li

2019年04月25日55分42秒