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.8.2r1

Yahoo! UI Library > menu > YAHOO.widget.Menu
Search:
 
Filters

Class YAHOO.widget.Menu - extends YAHOO.widget.Overlay

Known Subclasses:
YAHOO.widget.MenuBar YAHOO.widget.ContextMenu
The Menu class creates a container that holds a vertical list representing a set of options or commands. Menu is the base class for all menu containers.

Constructor

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

Properties

_aGroupTitleElements - private Array

Array of HTML element used to title groups of menu items.
Default Value: []

_aItemGroups - private Array

Multi-dimensional Array representing the menu items as they are grouped in the menu.
Default Value: []

_aListElements - private Array

Array of <ul> elements, each of which is the parent node for each item's <li> element.
Default Value: []

_bHandledMouseOutEvent - private Boolean

Boolean indicating the current state of the menu's "mouseout" event.
Default Value: false

_bHandledMouseOverEvent - private Boolean

Boolean indicating the current state of the menu's "mouseover" event.
Default Value: false

_bStopMouseEventHandlers - private Boolean

Stops "mouseover," "mouseout," and "mousemove" event handlers from executing.
Default Value: false

_nCurrentMouseX - private Number

The current x coordinate of the mouse inside the area of the menu.
Default Value: 0

_sClassName - private String

The current value of the "classname" configuration attribute.
Default Value: null

_useHideDelay - private Boolean

Boolean indicating if the "mouseover" and "mouseout" event handlers used for hiding the menu via a call to "YAHOO.lang.later" have already been assigned.
Default Value: false

activeItem - YAHOO.widget.MenuItem

Object reference to the item in the menu that has is selected.
Default Value: null

CSS_CLASS_NAME - final String

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

GROUP_TITLE_TAG_NAME - final String

String representing the tagname of the HTML element used to title the menu's item groups.
Default Value: H6

ITEM_TYPE - final YAHOO.widget.MenuItem

Object representing the type of menu item to instantiate and add when parsing the child nodes (either <li> element, <optgroup> element or <option>) of the menu's source HTML element.
Default Value: YAHOO.widget.MenuItem

itemData - Array

Array of items to be added to the menu. The array can contain strings representing the text for each item to be created, object literals representing the menu item configuration properties, or MenuItem instances. This property should be set via the constructor using the configuration object literal.
Default Value: null

lazyLoad - Boolean

Boolean indicating if the menu's "lazy load" feature is enabled. If set to "true," initialization and rendering of the menu's items will be deferred until the first time it is made visible. This property should be set via the constructor using the configuration object literal.
Default Value: false

OFF_SCREEN_POSITION - final String

Array representing the default x and y position that a menu should have when it is positioned outside the viewport by the "poistionOffScreen" method.
Default Value: "-999em"

parent - YAHOO.widget.MenuItem

Object reference to the menu's parent menu or menu item. This property can be set via the constructor using the configuration object literal.
Default Value: null

srcElement - HTMLSelectElement|HTMLDivElement

Object reference to the HTML element (either <select> or <div>) used to create the menu.
Default Value: null

Methods

_addItemToGroup

private YAHOO.widget.MenuItem _addItemToGroup ( p_nGroupIndex , p_oItem , p_nItemIndex )
Adds a menu item to a group.
Parameters:
p_nGroupIndex <Number> Number indicating the group to which the item belongs.
p_oItem <YAHOO.widget.MenuItem> Object reference for the MenuItem instance to be added to the menu.
p_oItem <String> String specifying the text of the item to be added to the menu.
p_oItem <Object> Object literal containing a set of menu item configuration properties.
p_nItemIndex <Number> Optional. Number indicating the index at which the menu item should be added.

_cancelHideDelay

private void _cancelHideDelay ( )
Cancels the call to "hideMenu."

_cancelShowDelay

private void _cancelShowDelay ( )
Cancels the call to the "showMenu."

_clearSetWidthFlag

private void _clearSetWidthFlag ( )
Change event listener for the "width" configuration property. This listener is added when a Menu's "width" configuration property is set by the "_setScrollHeight" method, and is used to set the "_widthSetForScroll" property to "false" if the "width" configuration property is changed after it was set by the "_setScrollHeight" method. If the "_widthSetForScroll" property is set to "false", and the "_setScrollHeight" method is in the process of tearing down scrolling functionality, it will maintain the Menu's new width rather than reseting it.

_configureSubmenu

private void _configureSubmenu ( p_oItem )
Subscribes the menu item's submenu to its parent menu's events.
Parameters:
p_oItem <YAHOO.widget.MenuItem> Object reference for the MenuItem instance with the submenu to be configured.

_createItemGroup

private Array _createItemGroup ( p_nIndex )
Creates a new menu item group (array) and its associated <ul> element. Returns an aray of menu item groups.
Parameters:
p_nIndex <Number> Number indicating the group to create.

_disableScrollFooter

protected void _disableScrollFooter ( )
Disables the footer used for scrolling the body of the menu.

_disableScrollHeader

protected void _disableScrollHeader ( )
Disables the header used for scrolling the body of the menu.

_enableScrollFooter

protected void _enableScrollFooter ( )
Enables the footer used for scrolling the body of the menu.

_enableScrollHeader

protected void _enableScrollHeader ( )
Enables the header used for scrolling the body of the menu.

_execHideDelay

private void _execHideDelay ( )
Hides the menu after the number of milliseconds specified by the "hidedelay" configuration property.

_execSubmenuHideDelay

private void _execSubmenuHideDelay ( p_oSubmenu , p_nMouseX , p_nHideDelay )
Hides a submenu after the number of milliseconds specified by the "submenuhidedelay" configuration property have ellapsed.
Parameters:
p_oSubmenu <YAHOO.widget.Menu> Object specifying the submenu that should be hidden.
p_nMouseX <Number> The x coordinate of the mouse when it left the specified submenu's parent menu item.
p_nHideDelay <Number> The number of milliseconds that should ellapse before the submenu is hidden.

_getFirstEnabledItem

private YAHOO.widget.MenuItem _getFirstEnabledItem ( )
Returns the first enabled item in the menu.

_getItemGroup

private Array _getItemGroup ( p_nIndex )
Returns the menu item group at the specified index.
Parameters:
p_nIndex <Number> Number indicating the index of the menu item group to be retrieved.

_initSubTree

private void _initSubTree ( )
Iterates the childNodes of the source element to find nodes used to instantiate menu and menu items.

_onBeforeHide

private void _onBeforeHide ( p_sType , p_aArgs )
"beforehide" event handler for the menu.
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.

_onBeforeRender

private void _onBeforeRender ( p_sType , p_aArgs )
"beforerender" event handler for the menu. Appends all of the <ul>, <li> and their accompanying title elements to the body element of the menu.
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.

_onBeforeShow

private void _onBeforeShow ( p_sType , p_aArgs )
"beforeshow" event handler for the menu.
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.

_onBlur

protected void _onBlur ( p_sType , p_aArgs )
"blur" event handler for a Menu instance.
Parameters:
p_sType <String> The name of the event that was fired.
p_aArgs <Array> Collection of arguments sent when the event was fired.

_onClick

protected void _onClick ( p_sType , p_aArgs )
"click" event handler for the menu.
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.

_onHide

private void _onHide ( p_sType , p_aArgs )
"hide" event handler for the menu.
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.

_onInit

private void _onInit ( p_sType , p_aArgs )
"init" event handler for the menu.
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.

_onItemAdded

private void _onItemAdded ( p_sType , p_aArgs )
"itemadded" event handler for a Menu instance.
Parameters:
p_sType <String> The name of the event that was fired.
p_aArgs <Array> Collection of arguments sent when the event was fired.

_onKeyDown

protected void _onKeyDown ( p_sType , p_aArgs )
"keydown" event handler for the menu.
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.

_onKeyPress

protected void _onKeyPress ( p_sType , p_aArgs )
"keypress" event handler for a Menu instance.
Parameters:
p_sType <String> The name of the event that was fired.
p_aArgs <Array> Collection of arguments sent when the event was fired.

_onMenuItemConfigChange

private void _onMenuItemConfigChange ( p_sType , p_aArgs , p_oItem )
"configchange" event handler for the menu's items.
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_oItem <YAHOO.widget.MenuItem> Object representing the menu item that fired the event.

_onMenuItemDestroy

private void _onMenuItemDestroy ( p_sType , p_aArgs , p_oItem )
"destroy" event handler for the menu's items.
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_oItem <YAHOO.widget.MenuItem> Object representing the menu item that fired the event.

_onMouseMove

protected void _onMouseMove ( p_oEvent , p_oMenu )
"click" event handler for the menu.
Parameters:
p_oEvent <Event> Object representing the DOM event object passed back by the event utility (YAHOO.util.Event).
p_oMenu <YAHOO.widget.Menu> Object representing the menu that fired the event.

_onMouseOut

protected void _onMouseOut ( p_sType , p_aArgs )
"mouseout" event handler for the menu.
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.

_onMouseOver

protected void _onMouseOver ( p_sType , p_aArgs )
"mouseover" event handler for the menu.
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.

_onParentMenuConfigChange

private void _onParentMenuConfigChange ( p_sType , p_aArgs , p_oSubmenu )
"configchange" event handler for a submenu.
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_oSubmenu <YAHOO.widget.Menu> Object representing the submenu that subscribed to the event.

_onParentMenuRender

private void _onParentMenuRender ( p_sType , p_aArgs , p_oSubmenu )
"render" event handler for a submenu. Renders a submenu in response to the firing of its parent's "render" event.
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_oSubmenu <YAHOO.widget.Menu> Object representing the submenu that subscribed to the event.

_onRender

private void _onRender ( p_sType , p_aArgs )
"render" event handler for the menu.
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.

_onScrollTargetMouseOut

protected void _onScrollTargetMouseOut ( p_oEvent , p_oMenu )
"mouseout" event handler for the menu's "header" and "footer" elements. Used to stop scrolling the body of the menu up and down when the menu's "maxheight" configuration property is set to a value greater than 0.
Parameters:
p_oEvent <Event> Object representing the DOM event object passed back by the event utility (YAHOO.util.Event).
p_oMenu <YAHOO.widget.Menu> Object representing the menu that fired the event.

_onScrollTargetMouseOver

protected void _onScrollTargetMouseOver ( p_oEvent , p_oMenu )
"mouseover" event handler for the menu's "header" and "footer" elements. Used to scroll the body of the menu up and down when the menu's "maxheight" configuration property is set to a value greater than 0.
Parameters:
p_oEvent <Event> Object representing the DOM event object passed back by the event utility (YAHOO.util.Event).
p_oMenu <YAHOO.widget.Menu> Object representing the menu that fired the event.

_onShow

private void _onShow ( p_sType , p_aArgs )
"show" event handler for the menu.
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.

_onVisibleChange

private void _onVisibleChange ( p_sType , p_aArgs )
Change event handler for the the menu's "visible" configuration property.
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.

_onYChange

protected void _onYChange ( p_sType , p_aArgs )
"y" event handler for a Menu instance.
Parameters:
p_sType <String> The name of the event that was fired.
p_aArgs <Array> Collection of arguments sent when the event was fired.

_removeItemFromGroupByIndex

private YAHOO.widget.MenuItem _removeItemFromGroupByIndex ( p_nGroupIndex , p_nItemIndex )
Removes a menu item from a group by index. Returns the menu item that was removed.
Parameters:
p_nGroupIndex <Number> Number indicating the group to which the menu item belongs.
p_nItemIndex <Number> Number indicating the index of the menu item to be removed.

_removeItemFromGroupByValue

private YAHOO.widget.MenuItem _removeItemFromGroupByValue ( p_nGroupIndex , p_oItem )
Removes a menu item from a group by reference. Returns the menu item that was removed.
Parameters:
p_nGroupIndex <Number> Number indicating the group to which the menu item belongs.
p_oItem <YAHOO.widget.MenuItem> Object reference for the MenuItem instance to be removed.

_setMaxHeight

private void _setMaxHeight ( p_sType , p_aArgs , p_nMaxHeight )
"renderEvent" handler used to defer the setting of the "maxheight" configuration property until the menu is rendered in lazy load scenarios.
Parameters:
p_sType <String> The name of the event that was fired.
p_aArgs <Array> Collection of arguments sent when the event was fired.
p_nMaxHeight <Number> Number representing the value to set for the "maxheight" configuration property.

_setScrollHeight

private void _setScrollHeight ( p_nScrollHeight )
Parameters:
p_nScrollHeight <String> Number representing the scrolling height of the Menu.

_subscribeToItemEvents

private void _subscribeToItemEvents ( p_oItem )
Subscribes a menu to a menu item's event.
Parameters:
p_oItem <YAHOO.widget.MenuItem> Object reference for the MenuItem instance whose events should be subscribed to.

_updateItemProperties

private void _updateItemProperties ( p_nGroupIndex )
Updates the "index," "groupindex," and "className" properties of the menu items in the specified group.
Parameters:
p_nGroupIndex <Number> Number indicating the group of items to update.

addItem

YAHOO.widget.MenuItem addItem ( p_oItem , p_nGroupIndex )
Appends an item to the menu.
Parameters:
p_oItem <YAHOO.widget.MenuItem> Object reference for the MenuItem instance to be added to the menu.
p_oItem <String> String specifying the text of the item to be added to the menu.
p_oItem <Object> Object literal containing a set of menu item configuration properties.
p_nGroupIndex <Number> Optional. Number indicating the group to which the item belongs.

addItems

Array addItems ( p_aItems , p_nGroupIndex )
Adds an array of items to the menu.
Parameters:
p_aItems <Array> Array of items to be added to the menu. The array can contain strings specifying the text for each item to be created, object literals specifying each of the menu item configuration properties, or MenuItem instances.
p_nGroupIndex <Number> Optional. Number specifying the group to which the items belongs.

blur

void blur ( )
Causes the menu to lose focus and fires the "blur" event.

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.

clearActiveItem

void clearActiveItem ( p_bBlur )
Sets the "selected" configuration property of the menu's active item to "false" and hides the item's submenu.
Parameters:
p_bBlur <Boolean> Boolean indicating if the menu's active item should be blurred.

clearContent

void clearContent ( )
Removes all of the content from the menu, including the menu items, group titles, header and footer.

configClassName

void configClassName ( p_sType , p_aArgs , p_oMenu )
Event handler for when the "classname" configuration property of a menu changes.
Parameters:
p_sType <String> The name of the event that was fired.
p_aArgs <Array> Collection of arguments sent when the event was fired.
p_oMenu <YAHOO.widget.Menu> The Menu instance fired the event.

configContainer

void configContainer ( p_sType , p_aArgs , p_oMenu )
Event handler for when the "container" configuration property of the menu changes.
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_oMenu <YAHOO.widget.Menu> Object representing the menu that fired the event.

configDisabled

void configDisabled ( p_sType , p_aArgs , p_oMenu )
Event handler for when the "disabled" configuration property of a menu changes.
Parameters:
p_sType <String> The name of the event that was fired.
p_aArgs <Array> Collection of arguments sent when the event was fired.
p_oMenu <YAHOO.widget.Menu> The Menu instance fired the event.

configHideDelay

void configHideDelay ( p_sType , p_aArgs , p_oMenu )
Event handler for when the "hidedelay" configuration property of the menu changes.
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_oMenu <YAHOO.widget.Menu> Object representing the menu that fired the event.

configIframe

void configIframe ( p_sType , p_aArgs , p_oMenu )
Event handler for when the "iframe" configuration property of the menu changes.
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_oMenu <YAHOO.widget.Menu> Object representing the menu that fired the event.

configMaxHeight

void configMaxHeight ( p_sType , p_aArgs , p_oMenu )
Event handler for when the "maxheight" configuration property of a Menu changes.
Parameters:
p_sType <String> The name of the event that was fired.
p_aArgs <Array> Collection of arguments sent when the event was fired.
p_oMenu <YAHOO.widget.Menu> The Menu instance fired the event.

configPosition

void configPosition ( p_sType , p_aArgs , p_oMenu )
Event handler for when the "position" configuration property of the menu changes.
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_oMenu <YAHOO.widget.Menu> Object representing the menu that fired the event.

configShadow

void configShadow ( p_sType , p_aArgs , p_oMenu )
Event handler for when the "shadow" configuration property of a menu changes.
Parameters:
p_sType <String> The name of the event that was fired.
p_aArgs <Array> Collection of arguments sent when the event was fired.
p_oMenu <YAHOO.widget.Menu> The Menu instance fired the event.

configVisible

void configVisible ( p_sType , p_aArgs , p_oMenu )
Event handler for when the "visible" configuration property the menu changes.
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_oMenu <YAHOO.widget.Menu> Object representing the menu that fired the event.

destroy

void destroy ( )
Removes the menu's <div> element (and accompanying child nodes) from the document.

focus

void focus ( )
Causes the menu to receive focus and fires the "focus" event.

getItem

YAHOO.widget.MenuItem getItem ( p_nItemIndex , p_nGroupIndex )
Returns the item at the specified index.
Parameters:
p_nItemIndex <Number> Number indicating the ordinal position of the item to be retrieved.
p_nGroupIndex <Number> Optional. Number indicating the group to which the item belongs.

getItemGroups

Array getItemGroups ( )
Multi-dimensional Array representing the menu items as they are grouped in the menu.

getItems

Array getItems ( )
Returns an array of all of the items in the menu.

getRoot

void getRoot ( )
Finds the menu's root menu.

getSubmenus

Array getSubmenus ( )
Returns an array of all of the submenus that are immediate children of the menu.

hasFocus

Boolean hasFocus ( )
Returns a boolean indicating whether or not the menu has focus.

init

void init ( p_oElement , p_oConfig )
The Menu 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.
p_oElement <String> String specifying the id attribute of the <select> element to be used as the data source for the menu.
p_oElement <HTMLDivElement> Object specifying the <div> element of the menu.
p_oElement <HTMLSelectElement> Object specifying the <select> element to be used as the data source for the menu.
p_oConfig <Object> Optional. Object literal specifying the configuration for the menu. See configuration class documentation for more details.

initDefaultConfig

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

initEvents

void initEvents ( )
Initializes the custom events for the menu.

insertItem

YAHOO.widget.MenuItem insertItem ( p_oItem , p_nItemIndex , p_nGroupIndex )
Inserts an item into the menu at the specified index.
Parameters:
p_oItem <YAHOO.widget.MenuItem> Object reference for the MenuItem instance to be added to the menu.
p_oItem <String> String specifying the text of the item to be added to the menu.
p_oItem <Object> Object literal containing a set of menu item configuration properties.
p_nItemIndex <Number> Number indicating the ordinal position at which the item should be added.
p_nGroupIndex <Number> Optional. Number indicating the group to which the item belongs.

positionOffScreen

void positionOffScreen ( )
Positions the menu outside of the boundaries of the browser's viewport. Called automatically when a menu is hidden to ensure that it doesn't force the browser to render uncessary scrollbars.

removeItem

YAHOO.widget.MenuItem removeItem ( p_oObject , p_nGroupIndex )
Removes the specified item from the menu.
Parameters:
p_oObject <YAHOO.widget.MenuItem> Object reference for the MenuItem instance to be removed from the menu.
p_oObject <Number> Number specifying the index of the item to be removed.
p_nGroupIndex <Number> Optional. Number specifying the group to which the item belongs.

setInitialFocus

void setInitialFocus ( )
Sets focus to the menu's first enabled item.

setInitialSelection

void setInitialSelection ( )
Sets the "selected" configuration property of the menu's first enabled item to "true."

setItemGroupTitle

void setItemGroupTitle ( p_sGroupTitle , p_nGroupIndex )
Sets the title of a group of menu items.
Parameters:
p_sGroupTitle <String> String specifying the title of the group.
p_nGroupIndex <Number> Optional. Number specifying the group to which the title belongs.

subscribe

void subscribe ( p_type , p_fn , p_obj , p_override )
Adds the specified CustomEvent subscriber to the menu and each of its submenus.
Parameters:
p_type <string> the type, or name of the event
p_fn <function> the function to exectute when the event fires
p_obj <Object> An object to be passed along when the event fires
p_override <boolean> If true, the obj passed in becomes the execution scope of the listener

toString

String toString ( )
Returns a string representing the menu.

Events

clickEvent

clickEvent ( )
Fires when the user clicks the on the menu. Passes back the DOM Event object as an argument.

itemAddedEvent

itemAddedEvent ( )
Fires when an item is added to the menu.

itemRemovedEvent

itemRemovedEvent ( )
Fires when an item is removed to the menu.

keyDownEvent

keyDownEvent ( )
Fires when the user presses a key when one of the menu's items has focus. Passes back the DOM Event object as an argument.

keyPressEvent

keyPressEvent ( )
Fires when the user presses an alphanumeric key when one of the menu's items has focus. Passes back the DOM Event object as an argument.

keyUpEvent

keyUpEvent ( )
Fires when the user releases a key when one of the menu's items has focus. Passes back the DOM Event object as an argument.

mouseDownEvent

mouseDownEvent ( )
Fires when the user mouses down on the menu. Passes back the DOM Event object as an argument.

mouseOutEvent

mouseOutEvent ( )
Fires when the mouse has left the menu. Passes back the DOM Event object as an argument.

mouseOverEvent

mouseOverEvent ( )
Fires when the mouse has entered the menu. Passes back the DOM Event object as an argument.

mouseUpEvent

mouseUpEvent ( )
Fires when the user releases a mouse button while the mouse is over the menu. Passes back the DOM Event object as an argument.

Configuration Attributes

autosubmenudisplay - Boolean

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

classname - String

String representing the CSS class to be applied to the menu's root <div> element. The specified class(es) are appended in addition to the default class as specified by the menu's CSS_CLASS_NAME constant. When set this property is automatically applied to all submenus.
Default Value: null

clicktohide - Boolean

Boolean indicating if the menu will automatically be hidden if the user clicks outside of it. This property is only applied when the "position" configuration property is set to dynamic and is automatically applied to all submenus.
Default Value: true

constraintoviewport - Boolean

Boolean indicating if the menu will try to remain inside the boundaries of the size of viewport. This property is only applied when the "position" configuration property is set to dynamic and is automatically applied to all submenus.
Default Value: true

container - HTMLElement|String

HTML element reference or string specifying the id attribute of the HTML element that the menu's markup should be rendered into.
Default Value: document.body

context - Array

Array of context arguments for context-sensitive positioning. The format is: [id or element, element corner, context corner]. For example, setting this property to ["img1", "tl", "bl"] would align the Menu's top left corner to the context element's bottom left corner. This property is only applied when the "position" configuration property is set to dynamic.
Default Value: null

disabled - Boolean

Boolean indicating if the menu should be disabled. Disabling a menu disables each of its items. (Disabled menu items are dimmed and will not respond to user input or fire events.) Disabled menus have a corresponding "disabled" CSS class applied to their root <div> element.
Default Value: false

effect - Object

Object or array of objects representing the ContainerEffect classes that are active for animating the container. When set this property is automatically applied to all submenus.
Default Value: null

fixedcenter - Boolean

Boolean indicating if the Menu should be anchored to the center of the viewport. This property is only applied when the "position" configuration property is set to dynamic.
Default Value: false

hidedelay - Number

Number indicating the time (in milliseconds) that should expire before the menu is hidden. This property is only applied when the "position" configuration property is set to dynamic and is automatically applied to all submenus.
Default Value: 0

iframe - Boolean

Boolean indicating whether or not the Menu should have an IFRAME shim; used to prevent SELECT elements from poking through an Overlay instance in IE6. When set to "true", the iframe shim is created when the Menu instance is intially made visible. This property is only applied when the "position" configuration property is set to dynamic and is automatically applied to all submenus.
Default Value: true for IE6 and below, false for all other browsers.

keepopen - Boolean

Boolean indicating if the menu should remain open when clicked.
Default Value: false

maxheight - Number

Number defining the maximum height (in pixels) for a menu's body element (<div class="bd">). Once a menu's body exceeds this height, the contents of the body are scrolled to maintain this value. This value cannot be set lower than the value of the "minscrollheight" configuration property.
Default Value: 0

minscrollheight - Number

Number defining the minimum threshold for the "maxheight" configuration property. When set this property is automatically applied to all submenus.
Default Value: 90

position - String

String indicating how a menu should be positioned on the screen. Possible values are "static" and "dynamic." Static menus are visible by default and reside in the normal flow of the document (CSS position: static). Dynamic menus 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: dynamic

preventcontextoverlap - Boolean

Boolean indicating whether or not a submenu should overlap its parent MenuItem when the "constraintoviewport" configuration property is set to "true".
Default Value: true

scrollincrement - Number

Number used to control the scroll speed of a menu. Used to increment the "scrollTop" property of the menu's body by when a menu's content is scrolling. When set this property is automatically applied to all submenus.
Default Value: 1

shadow - Boolean

Boolean indicating if the menu should have a shadow.
Default Value: true

showdelay - Number

Number indicating the time (in milliseconds) that should expire before a submenu is made visible when the user mouses over the menu's items. This property is only applied when the "position" configuration property is set to dynamic and is automatically applied to all submenus.
Default Value: 250

submenualignment - Array

Array defining how submenus should be aligned to their parent menu item. The format is: [itemCorner, submenuCorner]. By default a submenu's top left corner is aligned to its parent menu item's top right corner.
Default Value: ["tl","tr"]

submenuhidedelay - Number

Number indicating the time (in milliseconds) that should expire before a submenu is hidden when the user mouses out of a menu item heading in the direction of a submenu. The value must be greater than or equal to the value specified for the "showdelay" configuration property. This property is only applied when the "position" configuration property is set to dynamic and is automatically applied to all submenus.
Default Value: 250

visible - Boolean

Boolean indicating whether or not the menu is visible. If the menu's "position" configuration property is set to "dynamic" (the default), this property toggles the menu's <div> element's "visibility" style property between "visible" (true) or "hidden" (false). If the menu's "position" configuration property is set to "static" this property toggles the menu's <div> element's "display" style property between "block" (true) or "none" (false).
Default Value: false

x - Number

Number representing the absolute x-coordinate position of the Menu. This property is only applied when the "position" configuration property is set to dynamic.
Default Value: null

xy - Number[]

Array of the absolute x and y positions of the Menu. This property is only applied when the "position" configuration property is set to dynamic.
Default Value: null

y - Number

Number representing the absolute y-coordinate position of the Menu. This property is only applied when the "position" configuration property is set to dynamic.
Default Value: null


Copyright © 2010 Yahoo! Inc. All rights reserved.