YUI recommends YUI3.
YUI 2 has been deprecated since 2011. This site acts as an archive for files and documentation.
This documentation is no longer maintained.
This example demonstrates how to skin a Menu widget as well as how to
transform an existing <ul>
element into an
operating-system-like menu via the technique of
Progressive Enhancement: If
JavaScript is disabled the content of the Menu will still be available. When
JavaScript is enabled, the <ul>
element will be
transformed into a Menu widget.
Begin by adding the Menu markup to page, leaving off any Menu-specific CSS class names from the HTML elements to ensure the markup isn't rendered as a Menu widget if JavaScript is disabled.
Use the onContentReady
method of the Event utility to instantiate the Menu as soon as
its markup is available for scripting. Once the Menu is instantiated, the
necessary Menu CSS class names will be appended to each element, so that the
<ul>
element will be rendered will be rendered as a
Menu widget.
Skinning the Menu widget is done using CSS. The stylesheet used for other Menu examples is a minified version of the menu-core.css and menu-skin.css files. When customizing the Menu skin, use the raw source files as a reference.
The menu-core.css file includes foundational styling that controls basic layout and positioning, whereas the menu-skin.css file is used to apply colors, borders, padding, etc. Skinning can be accomplished by either overriding the styles defined in the menu-skin.css file, or by creating an entirely new skin file. When overriding styles, place them in a separate file to simplify integrating with YUI updates. The follow example illustrates how to override some of the default styles defined by the "Sam" skin.
All YUI 2.x users should review the YUI 2.8.2 security bulletin, which discusses a vulnerability present in YUI 2.4.0-2.8.1.
Copyright © 2013 Yahoo! Inc. All rights reserved.