Important Note: The following article describes how you can keep a menu item highlighted manually. Since version 5.2.798 of AllWebMenus, the "Show Item or Group on Appear" feature has been introduced which automatically highlights an item when the URL matches it's <Link> property and more.

When creating your JavaScript menus:

You can keep a Main Menu item highlighted when visiting a web page by using the following code inside your page:

<script>awmSelectedItem=x</script>

where x is the order of the Main Menu item you wish to be shown as selected.

By doing so, the selected item will be displayed with its [Mouse Click] state instead of its [Normal] state.

Example:

Let's assume you have the following menu and you want the "Downloads" item to be highlighted when you visit the downloads.html page.

Let's also assume that the "Downloads" item is the 2nd item in the Main Menu. You just need to put the following code before the menu-linking code inside your downloads.html page:

<script>awmSelectedItem=2</script>

When you now visit the downloads.html page, all Main Menu items will be displayed at their [Normal] state except of the "Downloads" item which will be displayed at its [Mouse Click] state.

Notes:
- This feature applies only for the Main Menu items. You cannot use this feature to have a submenu item highlighted.

- The [Mouse Over] state will be displayed instead of the [Mouse Click] state if you have the "Ignore [Mouse Click] values" box checked inside the Tools -> Project Properties -> Optimization tab.

Special note for multiple menus only:

If you have more than one menu in the same page, then you need to use the <script>awmSelectedItem=x</script> right before the menu-linking section of all menus:

where,

x = the number of the selected item for the menu you want to have the highlighted option and

x = 0 for the rest of the menus.

Tags: