Highlighting the active menu item
With menu widgets, depending on how the items are configured, the only way to tell if an item is active is when the page URL changes as a result of an item being clicked on. The menu items don't give any obvious indication that anything has actually happened. For example, the item in a menu, once clicked, could change the visual state. This is especially helpful if the developer is using the menu widget as a navigational tool in the user interface. Let's look at how we can extend the capabilities of the menu widget in order to provide this functionality using parts from the theme framework.
Getting ready
We'll use the following HTML code for our menu example here. Notice that this particular menu has a nested submenu:
<ul id="menu"> <li><a href="#first">First Item</a></li> <li><a href="#second">Second Item</a></li> <li><a href="#third">Third Item</a></li> <li>...