NOTICE: This component is deprecated
as of YUI 3.9.0 and will be removed in future versions.
If you require functionality similar to the one provided by this module, consider taking a look at the various modules in the YUI Gallery.
The MenuNav Node Plugin makes it easy to transform existing list-based
markup into traditional, drop down navigational menus that are both
accessible and easy to customize, and only require a small set of
dependencies. The MenuNav Node Plugin features:
- Progressive Enhancement
-
The MenuNav Node Plugin is designed to support
Progressive Enhancement,
making it easy to transform simple, semantic markup into dynamic
drop-down menus with just a few lines of JavaScript.
- Small footprint
-
The MenuNav Node Plugin has a small footprint of ~5 KB (GZIP'd) and
requires a minimal set of dependencies.
- Accessibility & Usability Minded
-
The MenuNav Node Plugin was built with both accessibility and usability
in mind. The MenuNav Node Plugin implements established mouse and
keyboard interaction patterns to deliver a user experience that is both
familiar and easy to use. To that foundation the MenuNav Node plugin
adds support for screen readers through the use of the
WAI-ARIA Roles and States.
- Easy to style and configure
-
The MenuNav Node Plugin is easy to configure. The visual presentation
of menus is controlled completely via CSS. A handful of
straightforward [[#configuration attributes]] can be used to make
common modifications to a menu's behavior.
- `
-
No menuing system would be complete without an
`
{{>getting-started}}
{{>need-skin-note}}
```
{{>need-skin-comment}}
```
Basic Setup
To create a menu using the MenuNav Node Plugin, start by including the required markup. The markup
for menus created using the MenuNav Node Plugin follows the same pattern established for Widgets,
with each menu's content box containing one or more `
` elements:
Menu Markup Example
```
```
Menu items also follow the Widget markup pattern, with the root node defined using an
`
- ` element:
MenuItem Markup Example
```
```
Submenus are defined by wrapping the the menu markup in an <li>
element. Each
submenu must have have a label. The label should preceed the menu markup, and the label's
href
attribute should be set to the point to the id of its corresponding submenu.
Submenu Markup Example
```
-
```
Following the patterns illustrated above, the markup for a menu created using the MenuNav Node
Plugin comes together as follows:
```
```
With the markup for the menu in place, simply get a Node reference for the root menu and then call
the plug
method, passing in a reference to the MenuNav Node Plugin.
```
// Call the "use" method, passing in "node-menunav". This will load the
// script and CSS for the MenuNav Node Plugin and all of the required
// dependencies.
YUI().use("node-menunav", function(Y) {
// Use the "contentready" event to initialize the menu when the subtree of
// element representing the root menu (