我有一个我需要在特定分支上打开的树状菜单 1.点击A元素我打开所有下一个UL。 现在我想关闭所有其他UL来处理作为A元素父母的那些。
我的jquery代码
$(document).ready(function() {
$(".solmenu").click(function() {
$(this).nextAll("ul").slideToggle();
});
我的css
ul.solmenu_3140_1 {display:none;}
ul.solmenu_3140_2 {display:none;}
我的HTML
<ul class="solmenu_3140_0">
<li>
<a class="solmenu" href="javascript:void(0);">1</a>
<ul class="solmenu_3140_1">
<li>
<a class="solmenu" href="javascript:void(0);">11</a>
<ul class="solmenu_3140_2">
<li>
<a class="solmenu" href="javascript:void(0);">111</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">112</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">113</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">114</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">115</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">116</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">117</a>
</li>
</ul>
</li>
</ul>
<ul class="solmenu_3140_1">
<li>
<a class="solmenu" href="javascript:void(0);">12</a>
<ul class="solmenu_3140_2">
<li>
<a class="solmenu" href="javascript:void(0);">121</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">122</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">123</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">124</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">125</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">126</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">127</a>
</li>
</ul>
</li>
</ul>
<ul class="solmenu_3140_1">
<li>
<a class="solmenu" href="javascript:void(0);">13</a>
<ul class="solmenu_3140_2">
<li>
<a class="solmenu" href="javascript:void(0);">131</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">132</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">133</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">134</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">135</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">136</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">137</a>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<ul class="solmenu_3140_0">
<li>
<a class="solmenu" href="javascript:void(0);">2</a>
<ul class="solmenu_3140_1">
<li>
<a class="solmenu" href="javascript:void(0);">21</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">22</a>
</li>
</ul>
</li>
</ul>
<ul class="solmenu_3140_0">
<li>
<a class="solmenu" href="javascript:void(0);">3</a>
<ul class="solmenu_3140_1">
<li>
<a class="solmenu" href="javascript:void(0);">31</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">32</a>
</li>
</ul>
</li>
</ul>
<ul class="solmenu_3140_0">
<li>
<a class="solmenu" href="javascript:void(0);">4</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">5</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">6</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">7</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">8</a>
<ul class="solmenu_3140_1">
<li>
<a class="solmenu" href="javascript:void(0);">81</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">82</a>
</li>
</ul>
</li>
</ul>
<ul class="solmenu_3140_0">
<li>
<a class="solmenu" href="javascript:void(0);">9</a>
<ul class="solmenu_3140_1">
<li>
<a class="solmenu" href="javascript:void(0);">91</a>
<ul class="solmenu_3140_2">
<li>
<a class="solmenu" href="javascript:void(0);">911</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">912</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">913</a>
</li>
</ul>
</li>
</ul>
<ul class="solmenu_3140_1">
<li>
<a class="solmenu" href="javascript:void(0);">92</a>
</li>
</ul>
</li>
</ul>
<ul class="solmenu_3140_0">
<li>
<a class="solmenu" href="javascript:void(0);">10</a>
</li>
</ul>