Class MochiKit.Widget.Popup
Extends
MochiKit.Widget.
The popup widget class. Used to provide a popup menu or
information area, using a <div> HTML element. The Popup
widget will automatically disappear after a configurable
amount of time, unless the user performs keyboard or mouse
actions related to the popup. In addition to standard HTML
events, the "onshow" and "onhide" events are triggered when
the menu has been shown or hidden.
Defined in: Widget.js.
Constructor Attributes | Constructor Name and Description |
---|---|
MochiKit.Widget.Popup(attrs)
Creates a new popup widget.
|
- Fields borrowed from class MochiKit.Widget:
- _id, Classes
Method Attributes | Method Name and Description |
---|---|
_handleMouseClick(evt)
Handles mouse click events on the popup.
|
|
_handleMouseMove(evt)
Handles mouse move events over the popup.
|
|
hide()
Hides the popup.
|
|
Resets the popup auto-hide timer.
|
|
selectChild(indexOrNode)
Marks a popup child as selected.
|
|
Returns the currently selected child node.
|
|
selectMove(offset)
Moves the current selection by a numeric offset.
|
|
setAttrs(attrs)
Updates the widget or HTML DOM node attributes.
|
|
show()
Shows the popup.
|
- Methods borrowed from class MochiKit.Widget:
- _animQueueId, _createWidgetTreeElem, _eventHandler, _widgetMixin, addAll, addChildNode, addClass, animate, blurAll, createWidget, createWidgetTree, destroy, destroyWidget, emitSignal, getChildNodes, hasClass, isFormField, isHidden, isWidget, removeAll, removeChildNode, removeClass, setStyle, toggleClass
Class Detail
MochiKit.Widget.Popup(attrs)
Creates a new popup widget.
- Parameters:
- {Object} attrs
- the widget and node attributes
- {Number} attrs.delay Optional
- the widget auto-hide delay in milliseconds, defaults to 5000
- {Object} attrs.showAnim Optional
- the optional animation options when showing the popup, defaults to none
- {Object} attrs.hideAnim Optional
- the optional animation options when hiding the popup, defaults to none
- {Widget} ... Optional
- the child widgets or DOM nodes
- Returns:
- {Widget} the widget DOM node
Method Detail
_handleMouseClick(evt)
Handles mouse click events on the popup.
- Parameters:
- {Event} evt
- the MochiKit.Signal.Event object
_handleMouseMove(evt)
Handles mouse move events over the popup.
- Parameters:
- {Event} evt
- the MochiKit.Signal.Event object
hide()
Hides the popup.
resetDelay()
Resets the popup auto-hide timer. Might be called manually when
receiving events on other widgets related to this one.
selectChild(indexOrNode)
Marks a popup child as selected. The currently selected child will
automatically be unselected by this method.
- Parameters:
- {Number/Node} indexOrNode
- the child node index or DOM node, use a negative value to unselect
- Returns:
- the index of the newly selected child, or -1 if none was selected
{Node}
selectedChild()
Returns the currently selected child node.
- Returns:
- {Node} the currently selected child node, or null if no node is selected
selectMove(offset)
Moves the current selection by a numeric offset.
- Parameters:
- {Number} offset
- the selection offset (a positive or negative number)
- Returns:
- the index of the newly selected child, or -1 if none was selected
setAttrs(attrs)
Updates the widget or HTML DOM node attributes.
- Parameters:
- {Object} attrs
- the widget and node attributes to set
- {Number} attrs.delay Optional
- the widget auto-hide delay in milliseconds, defaults to 5000
- {Object} attrs.showAnim Optional
- the optional animation options when showing the popup, defaults to none
- {Object} attrs.hideAnim Optional
- the optional animation options when hiding the popup, defaults to none
show()
Shows the popup.