简体   繁体   English

如何在关闭jQuery手风琴菜单时折叠所有子菜单

[英]How to collapse all submenus on closing jQuery accordion menu

I have previously asked this question . 我以前曾问过这个问题 The solution provided by Ahs N worked great. Ahs N提供的解决方案效果很好。 But now when the menu is closed and opened again, the sub-items that were previously opened are still open in whatever configuration they were left. 但是现在,当菜单关闭并再次打开时,以前打开的子项目仍会以其保留的任何配置打开。 How do I clear this state but still retain the effects of the excellent solution I am using? 如何清除此状态,但仍保留我使用的出色解决方案的效果?

This is what I did and seems to work according to what you asked: 这是我所做的,并且似乎可以根据您的要求进行工作:

if(name=="H3"){
      $(target).next().show().find("p, div").show();
}

Here is the link to the CodePen 这是指向CodePen的链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM