⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 menu-debug.js

📁 这是YUI的源码及相关示例。里面有很多很炫的Javascript效果。
💻 JS
📖 第 1 页 / 共 5 页
字号:
};/*** @method checkPosition* @description Checks to make sure that the value of the "position" property * is one of the supported strings. Returns true if the position is supported.* @private* @param {Object} p_sPosition String specifying the position of the menu.* @return {Boolean}*/function checkPosition(p_sPosition) {	var returnVal = false;    if (Lang.isString(p_sPosition)) {        returnVal = (_DYNAMIC_STATIC.indexOf((p_sPosition.toLowerCase())) != -1);    }	return returnVal;}var Dom = YAHOO.util.Dom,    Event = YAHOO.util.Event,    Module = YAHOO.widget.Module,    Overlay = YAHOO.widget.Overlay,    Menu = YAHOO.widget.Menu,    MenuManager = YAHOO.widget.MenuManager,    CustomEvent = YAHOO.util.CustomEvent,    UA = YAHOO.env.ua,        m_oShadowTemplate,	EVENT_TYPES = [    		["mouseOverEvent", _MOUSEOVER],		["mouseOutEvent", _MOUSEOUT],		["mouseDownEvent", _MOUSEDOWN],		["mouseUpEvent", "mouseup"],		["clickEvent", "click"],		["keyPressEvent", "keypress"],		["keyDownEvent", _KEYDOWN],		["keyUpEvent", "keyup"],		["focusEvent", "focus"],		["blurEvent", "blur"],		["itemAddedEvent", _ITEM_ADDED],		["itemRemovedEvent", _ITEM_REMOVED]	],	VISIBLE_CONFIG =  { 		key: _VISIBLE, 		value: false, 		validator: Lang.isBoolean	}, 	CONSTRAIN_TO_VIEWPORT_CONFIG =  {		key: _CONSTRAIN_TO_VIEWPORT, 		value: true, 		validator: Lang.isBoolean, 		supercedes: [_IFRAME,"x",_Y,_XY]	}, 	PREVENT_CONTEXT_OVERLAP_CONFIG =  {		key: _PREVENT_CONTEXT_OVERLAP,		value: true,		validator: Lang.isBoolean,  		supercedes: [_CONSTRAIN_TO_VIEWPORT]	},	POSITION_CONFIG =  { 		key: _POSITION, 		value: _DYNAMIC, 		validator: checkPosition, 		supercedes: [_VISIBLE, _IFRAME]	}, 	SUBMENU_ALIGNMENT_CONFIG =  { 		key: _SUBMENU_ALIGNMENT, 		value: ["tl","tr"]	},	AUTO_SUBMENU_DISPLAY_CONFIG =  { 		key: _AUTO_SUBMENU_DISPLAY, 		value: true, 		validator: Lang.isBoolean,		suppressEvent: true	}, 	SHOW_DELAY_CONFIG =  { 		key: _SHOW_DELAY, 		value: 250, 		validator: Lang.isNumber, 		suppressEvent: true	}, 	HIDE_DELAY_CONFIG =  { 		key: _HIDE_DELAY, 		value: 0, 		validator: Lang.isNumber, 		suppressEvent: true	}, 	SUBMENU_HIDE_DELAY_CONFIG =  { 		key: _SUBMENU_HIDE_DELAY, 		value: 250, 		validator: Lang.isNumber,		suppressEvent: true	}, 	CLICK_TO_HIDE_CONFIG =  { 		key: _CLICK_TO_HIDE, 		value: true, 		validator: Lang.isBoolean,		suppressEvent: true	},	CONTAINER_CONFIG =  { 		key: _CONTAINER,		suppressEvent: true	}, 	SCROLL_INCREMENT_CONFIG =  { 		key: _SCROLL_INCREMENT, 		value: 1, 		validator: Lang.isNumber,		supercedes: [_MAX_HEIGHT],		suppressEvent: true	},	MIN_SCROLL_HEIGHT_CONFIG =  { 		key: _MIN_SCROLL_HEIGHT, 		value: 90, 		validator: Lang.isNumber,		supercedes: [_MAX_HEIGHT],		suppressEvent: true	},    	MAX_HEIGHT_CONFIG =  { 		key: _MAX_HEIGHT, 		value: 0, 		validator: Lang.isNumber,		supercedes: [_IFRAME],		suppressEvent: true	}, 	CLASS_NAME_CONFIG =  { 		key: _CLASSNAME, 		value: null, 		validator: Lang.isString,		suppressEvent: true	}, 	DISABLED_CONFIG =  { 		key: _DISABLED, 		value: false, 		validator: Lang.isBoolean,		suppressEvent: true	},		SHADOW_CONFIG =  { 		key: _SHADOW, 		value: true, 		validator: Lang.isBoolean,		suppressEvent: true,		supercedes: [_VISIBLE]	},		KEEP_OPEN_CONFIG = {		key: _KEEP_OPEN, 		value: false, 		validator: Lang.isBoolean	};YAHOO.lang.extend(Menu, Overlay, {// Constants/*** @property CSS_CLASS_NAME* @description String representing the CSS class(es) to be applied to the * menu's <code>&#60;div&#62;</code> element.* @default "yuimenu"* @final* @type String*/CSS_CLASS_NAME: "yuimenu",/*** @property ITEM_TYPE* @description Object representing the type of menu item to instantiate and * add when parsing the child nodes (either <code>&#60;li&#62;</code> element, * <code>&#60;optgroup&#62;</code> element or <code>&#60;option&#62;</code>) * of the menu's source HTML element.* @default YAHOO.widget.MenuItem* @final* @type YAHOO.widget.MenuItem*/ITEM_TYPE: null,/*** @property GROUP_TITLE_TAG_NAME* @description String representing the tagname of the HTML element used to * title the menu's item groups.* @default H6* @final* @type String*/GROUP_TITLE_TAG_NAME: "h6",/*** @property OFF_SCREEN_POSITION* @description 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 "-999em"* @final* @type String*/OFF_SCREEN_POSITION: "-999em",// Private properties/** * @property _bHideDelayEventHandlersAssigned* @description 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 false* @private* @type Boolean*/_bHideDelayEventHandlersAssigned: false,/*** @property _bHandledMouseOverEvent* @description Boolean indicating the current state of the menu's * "mouseover" event.* @default false* @private* @type Boolean*/_bHandledMouseOverEvent: false,/*** @property _bHandledMouseOutEvent* @description Boolean indicating the current state of the menu's* "mouseout" event.* @default false* @private* @type Boolean*/_bHandledMouseOutEvent: false,/*** @property _aGroupTitleElements* @description Array of HTML element used to title groups of menu items.* @default []* @private* @type Array*/_aGroupTitleElements: null,/*** @property _aItemGroups* @description Multi-dimensional Array representing the menu items as they* are grouped in the menu.* @default []* @private* @type Array*/_aItemGroups: null,/*** @property _aListElements* @description Array of <code>&#60;ul&#62;</code> elements, each of which is * the parent node for each item's <code>&#60;li&#62;</code> element.* @default []* @private* @type Array*/_aListElements: null,/*** @property _nCurrentMouseX* @description The current x coordinate of the mouse inside the area of * the menu.* @default 0* @private* @type Number*/_nCurrentMouseX: 0,/*** @property _bStopMouseEventHandlers* @description Stops "mouseover," "mouseout," and "mousemove" event handlers * from executing.* @default false* @private* @type Boolean*/_bStopMouseEventHandlers: false,/*** @property _sClassName* @description The current value of the "classname" configuration attribute.* @default null* @private* @type String*/_sClassName: null,// Public properties/*** @property lazyLoad* @description 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 false* @type Boolean*/lazyLoad: false,/*** @property itemData* @description 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 null* @type Array*/itemData: null,/*** @property activeItem* @description Object reference to the item in the menu that has is selected.* @default null* @type YAHOO.widget.MenuItem*/activeItem: null,/*** @property parent* @description 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 null* @type YAHOO.widget.MenuItem*/parent: null,/*** @property srcElement* @description Object reference to the HTML element (either * <code>&#60;select&#62;</code> or <code>&#60;div&#62;</code>) used to * create the menu.* @default null* @type <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/* level-one-html.html#ID-94282980">HTMLSelectElement</a>|<a * href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-html.* html#ID-22445964">HTMLDivElement</a>*/srcElement: null,// Events/*** @event mouseOverEvent* @description Fires when the mouse has entered the menu.  Passes back * the DOM Event object as an argument.*//*** @event mouseOutEvent* @description Fires when the mouse has left the menu.  Passes back the DOM * Event object as an argument.* @type YAHOO.util.CustomEvent*//*** @event mouseDownEvent* @description Fires when the user mouses down on the menu.  Passes back the * DOM Event object as an argument.* @type YAHOO.util.CustomEvent*//*** @event mouseUpEvent* @description Fires when the user releases a mouse button while the mouse is * over the menu.  Passes back the DOM Event object as an argument.* @type YAHOO.util.CustomEvent*//*** @event clickEvent* @description Fires when the user clicks the on the menu.  Passes back the * DOM Event object as an argument.* @type YAHOO.util.CustomEvent*//*** @event keyPressEvent* @description 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.* @type YAHOO.util.CustomEvent*//*** @event keyDownEvent* @description 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.* @type YAHOO.util.CustomEvent*//*** @event keyUpEvent* @description 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.* @type YAHOO.util.CustomEvent*//*** @event itemAddedEvent* @description Fires when an item is added to the menu.* @type YAHOO.util.CustomEvent*//*** @event itemRemovedEvent* @description Fires when an item is removed to the menu.* @type YAHOO.util.CustomEvent*//*** @method init* @description 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.* @param {String} p_oElement String specifying the id attribute of the * <code>&#60;div&#62;</code> element of the menu.* @param {String} p_oElement String specifying the id attribute of the * <code>&#60;select&#62;</code> element to be used as the data source * for the menu.* @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/* level-one-html.html#ID-22445964">HTMLDivElement</a>} p_oElement Object * specifying the <code>&#60;div&#62;</code> element of the menu.* @param {<a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/* level-one-html.html#ID-94282980">HTMLSelectElement</a>} p_oElement * Object specifying the <code>&#60;select&#62;</code> element to be used as * the data source for the menu.* @param {Object} p_oConfig Optional. Object literal specifying the * configuration for the menu. See configuration class documentation for * more details.*/init: function (p_oElement, p_oConfig) {    this._aItemGroups = [];    this._aListElements = [];    this._aGroupTitleElements = [];    if (!this.ITEM_TYPE) {        this.ITEM_TYPE = YAHOO.widget.MenuItem;    }    var oElement;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -