Accordion Menu / Posts /

Home page with no menu link active

My accordion menu does not contain the link to my home page. I noticed that it will leave the first menu item active by default if no menu links matching the current home page. How can I avoid this and keep no menu link active when navigated to the home page?
Jeff  11 years ago   viewed: 13176    

1 Answer

Good question.

One page load, the accordion menu will try to find the menu item whose href will best match the current page URL. If it does not find the exact match, it will choose the one that seems match the best (partially match). That is why it leaves your first menu item active in your scenario.

If you prefer no active one in this scenario, there are two solutions.

The first approach is to add a menu item with the current page URL and force it display:none (It is adding a hidden home page item into the menu in your scenario):

<div id="acdnmenu">
        <li style="display:none;"><a href="/">Home</a></li>
        ... ...

Another approach is to overwrite the CSS settings on the home page, and run the amenu.close(false); function:
<style> /*The code below is to overwrite the a.current settings with the none current link setting: #acdnmenu ul.sub { ...} It should be placed after the stylesheet link accordionmenu.css to guarantee the setting will be overwritten.*/ #acdnmenu ul.sub a.current, #acdnmenu ul.sub div.heading a.current { color:#000; text-decoration:underline; background:none; } </style>
Also add the below javascript function call:
<script> amenu.close(false); </script>
milo   11 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: