O'Reilly logo

jQuery UI Cookbook by Adam Boduch

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required