YUI recommends YUI 3.

YUI 2 has been deprecated since 2011. This site acts as an archive for files and documentation.

Yahoo! UI Library

Menu  2.5.0

Yahoo! UI Library > menu > YAHOO.widget.MenuBar

Show Private Show Protected

Class YAHOO.widget.MenuBar - extends YAHOO.widget.Menu

Horizontal collection of items, each of which can contain a submenu.

Constructor

YAHOO.widget.MenuBar ( p_oElement , p_oConfig )
Parameters:
p_oElement <String> String specifying the id attribute of the <div> element of the menu bar.
p_oElement <String> String specifying the id attribute of the <select> element to be used as the data source for the menu bar.
p_oElement <HTMLDivElement> Object specifying the <div> element of the menu bar.
p_oElement <HTMLSelectElement> Object specifying the <select> element to be used as the data source for the menu bar.
p_oConfig <Object> Optional. Object literal specifying the configuration for the menu bar. See configuration class documentation for more details.

Properties

CSS_CLASS_NAME - final String

String representing the CSS class(es) to be applied to the menu bar's <div> element.
Default Value: "yuimenubar"

DEFAULT_CONFIG - private final Object

Constant representing the MenuBar's configuration properties

Methods

_onClick

protected void _onClick ( p_sType , p_aArgs , p_oMenuBar )
"click" event handler for the menu bar.
Parameters:
p_sType <String> String representing the name of the event that was fired.
p_aArgs <Array> Array of arguments sent when the event was fired.
p_oMenuBar <YAHOO.widget.MenuBar> Object representing the menu bar that fired the event.
Returns: void

_onKeyDown

private void _onKeyDown ( p_sType , p_aArgs , p_oMenuBar )
"keydown" Custom Event handler for the menu bar.
Parameters:
p_sType <String> String representing the name of the event that was fired.
p_aArgs <Array> Array of arguments sent when the event was fired.
p_oMenuBar <YAHOO.widget.MenuBar> Object representing the menu bar that fired the event.
Returns: void

checkPosition

private Boolean checkPosition ( p_sPosition )
Checks to make sure that the value of the "position" property is one of the supported strings. Returns true if the position is supported.
Parameters:
p_sPosition <Object> String specifying the position of the menu.
Returns: Boolean

init

void init ( p_oElement , p_oConfig )
The MenuBar class's initialization method. This method is automatically called by the constructor, and sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.
Parameters:
p_oElement <String> String specifying the id attribute of the <div> element of the menu bar.
p_oElement <String> String specifying the id attribute of the <select> element to be used as the data source for the menu bar.
p_oElement <HTMLDivElement> Object specifying the <div> element of the menu bar.
p_oElement <HTMLSelectElement> Object specifying the <select> element to be used as the data source for the menu bar.
p_oConfig <Object> Optional. Object literal specifying the configuration for the menu bar. See configuration class documentation for more details.
Returns: void

initDefaultConfig

void initDefaultConfig ( )
Initializes the class's configurable properties which can be changed using the menu bar's Config object ("cfg").
Returns: void

toString

String toString ( )
Returns a string representing the menu bar.
Returns: String

Configuration Attributes

autosubmenudisplay - Boolean

Boolean indicating if submenus are automatically made visible when the user mouses over the menu bar's items.
Default Value: false

position - String

String indicating how a menu bar should be positioned on the screen. Possible values are "static" and "dynamic." Static menu bars are visible by default and reside in the normal flow of the document (CSS position: static). Dynamic menu bars are hidden by default, reside out of the normal flow of the document (CSS position: absolute), and can overlay other elements on the screen.
Default Value: static

submenualignment - Array

Array defining how submenus should be aligned to their parent menu bar item. The format is: [itemCorner, submenuCorner].
Default Value: ["tl","bl"]

Configuration attributes inherited from YAHOO.widget.Overlay:

Configuration attributes inherited from YAHOO.widget.Module:


Copyright © 2007 Yahoo! Inc. All rights reserved.