问题
I have previously asked this question. The solution provided by Ahs N worked great. 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?
回答1:
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
来源:https://stackoverflow.com/questions/31909296/how-to-collapse-all-submenus-on-closing-jquery-accordion-menu