我试图弄清楚如何通过单击菜单来隐藏其他子菜单项。现在,当单击两个菜单时,它们都会显示,这是我不想要的。
<script type="text/javascript" src="jquery/js/jquery-1.9.1.js"></script>
<script src="jquery/js/jquery-ui-1.10.3.custom.js"></script>
<script>
jQuery(function ($) {
$(".accordion").accordion({
active: false,
autoHeight: false,
collapsible: true,
alwaysOpen: false
});
function collapseAll() {
$("#accordion")
.filter(":has(.ui-state-active)")
.accordion("activate", -1);
$(".ui-accordion-header").blur();
}
});
<div class="navigation">
<ul class="accordion">
<li>
<asp:HyperLink ID="about" runat="server" href="#" text="testing" />
<div class="sub accordion">
<ul>
<li><asp:HyperLink ID="aboutTraci" runat="server" NavigateUrl="traci.aspx" Text="Traci" /></li>
<li><asp:HyperLink ID="aboutTheBegan" runat="server" NavigateUrl="#" Text="How It All Began" /></li>
<li><asp:HyperLink ID="aboutDesigners" runat="server" NavigateUrl="#" Text="Designers" /></li>
<li><asp:HyperLink ID="aboutPlaygroup" runat="server" NavigateUrl="#" Text="Playgroup" /></li>
<li><asp:HyperLink ID="aboutPlayground" runat="server" NavigateUrl="#" Text="Playground" /></li>
<li><asp:HyperLink ID="aboutTestimonials" runat="server" NavigateUrl="testimonials.aspx" Text="Testimonials" /></li>
</ul>
</div>
</li>
</ul>
<ul class="accordion">
<li>
<asp:HyperLink ID="HyperLink1" runat="server" href="#" Text="testing" />
<div class="sub accordion">
<ul>
<li><asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl="traci.aspx" Text="Traci" /></li>
<li><asp:HyperLink ID="HyperLink3" runat="server" NavigateUrl="#" Text="How It All Began" /></li>
<li><asp:HyperLink ID="HyperLink4" runat="server" NavigateUrl="#" Text="Designers" /></li>
<li><asp:HyperLink ID="HyperLink5" runat="server" NavigateUrl="#" Text="Playgroup" /></li>
<li><asp:HyperLink ID="HyperLink6" runat="server" NavigateUrl="#" Text="Playground" /></li>
<li><asp:HyperLink ID="HyperLink7" runat="server" NavigateUrl="testimonials.aspx" Text="Testimonials" /></li>
</ul>
</div>
</li>
</ul>
</div>
单击一个菜单项时,我想隐藏其他菜单项。
谢谢