It started with a question. Having received a brilliant answer, I ran into an unexpected gap in functionality: how can I open the default menu?
More specifically, if a user lands on a page that exists in my sub-navigator, I want this sub-navigator to be open with the current page highlighted. If they use the menu for viewing, it will change accordingly, but always return to the default state if they do not make a choice.
The code I use for this can be found in this jsfiddle .
The menu structure is similar:
<div id="mnav"> <ul id="buttons"> <li class="one"><a href="#">Main 1</a></li> <li class="two"><a href="#">Main 2</a></li> <li class="three"><a href="#">Main 3</a></li> <li class="four nav-dark"><a href="#">Main 4</a></li> </ul> </div> <div id="snav"> <ul class="snav-one"> <li><a href="#">Sub 1.1</a></li> <li><a href="#">Sub 1.2</a></li> <li><a href="#">Sub 1.3</a></li> </ul> <ul class="snav-two"> <li><a href="#">Sub 2.1</a></li> <li><a href="#">Sub 2.2</a></li> </ul> </div>
It has been suggested that the main idea is to freeze in order to return everything to how they were, and that makes sense, but how to maintain the original state in which the menu is located?
source share