gpt4 book ai didi

php - 侧面导航菜单问题

转载 作者:行者123 更新时间:2023-12-01 07:01:27 25 4
gpt4 key购买 nike

如何让所有嵌套列表在单击时折叠和展开。

这是我的 xHTML。

<ul>
<li><a href="some-link.php">First Nested List</a></li>
<li><a href="some-link.php">First Nested List</a></li>
<li><a href="some-link.php">First Nested List</a>
<ul>
<li><a href="some-link.php">Second Nested List</a></li>
<li><a href="some-link.php">Second Nested List</a></li>
<li><a href="some-link.php">Second Nested List</a>
<ul>
<li><a href="some-link.php">Third Nested List</a></li>
<li><a href="some-link.php">Third Nested List</a></li>
<li><a href="some-link.php">Third Nested List</a>
<ul>
<li><a href="some-link.php">Fourth Nested List</a></li>
<li><a href="some-link.php">Fourth Nested List</a></li>
<li><a href="some-link.php">Fourth Nested List</a></li>
</ul>
</li>
<li><a href="some-link.php">Third Nested List</a></li>
<li><a href="some-link.php">Third Nested List</a></li>
</ul>
</li>
<li><a href="some-link.php">Second Nested List</a></li>
<li><a href="some-link.php">Second Nested List</a></li>
</ul>
</li>
<li><a href="some-link.php">First Nested List</a></li>
<li><a href="some-link.php">First Nested List</a></li>
</ul>

最佳答案

我不确定您到底想要什么,但总体概念如下:

$("li").click(function(e) {
$(this).children('ul').toggle(400); //toggle the immediate child <ul>
return false; //stop the click from bubbling up, and the href working
});

You can give it a try with your markup here .

关于php - 侧面导航菜单问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3508819/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com