Accordion Menu / Posts /

Collapse sub menus

Someone asked this question and it was not answered properly.

How can I over ride this.
"You can also set the heading text within a hyperlink(<a href="..."> ... </a>).
In that case, its submenu (if any) will not be collapsed at the page load so that the submenu items are visible and accessible without the need of clicking on the heading."

The answer refers to the "built in open and close" functionality, but it does not explain the mark up to target the sub sub menus under the open header. Please clarify.
Katie  4 years ago   viewed: 5196    

4 Answers

Thanks to your question, Katie.

I don't think it is referring to the "built in open and close" functionality. It just explains what will happen when you wrap your heading text(it has a submenu UL that follows the heading text) with <a href="..."> ... </a>.

But if you want to override this so that the submenu under the heading will be in a close state, then you are right because you must use the "built-in open and close" functionality to accomplish that.

Sorry I don't quite understand what "the mark up to target the sub sub menus under the open header" means.

Actually I tend to think we should not allow the heading to be wrapped with an anchor tag. That makes life easy and we can get rid of the confusing stuff that we are discussing now. Do you agree with me?
milo   4 years ago

Basically, I have a menu where all the headings are links. It is required for this particular project.

The top heading is a Region 'Asia', the next sub heading is 'China', and last sub headings is 'Beijing', 'Shenyang', and other cities. When the user clicks the Asia, the user is taken to 'Asia' page and all the sub navs below Asia are open, including cities. I just want the countries to be open, and the cities to be closed. When the user clicks on a country, then the cities in the subnav below should be shown, and all other navs should be closed.

If it is not possible to close the sub-subnav menus by default, we may have to find another plugin.

Katie   4 years ago

Did you try below:

1. Give LI of 'Asia' an ID, <li id="asia">Asia <ul>....

2. Add the script in page "Asia":

<script> amenu.close(false);"asia", true); </script>

Milo   4 years ago

You are just not going to take this question asked by so many people on board and answer it... Are you ? It is a perfectly logical thing that people are trying to achieve. I have the same problem.

Drew   2 years ago


Your name*
(Optional. Used to modify this post afterwords)
+ =  

Ask your Own Question

  • If your question is related to the topic of this post, you can post your question to this page by clicking the "Post a reply" button at left;

  • When you want to start a new page for your question: