YUI recommends YUI 3.

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

Yahoo! UI Library

Container  2.2.2

Yahoo! UI Library > container > YAHOO.widget.Tooltip

Class YAHOO.widget.Tooltip - extends YAHOO.widget.Overlay

Tooltip is an implementation of Overlay that behaves like an OS tooltip, displaying when the user mouses over a particular element, and disappearing on mouse out.

Constructor

YAHOO.widget.Tooltip ( el , userConfig )
Parameters:
el <String> The element ID representing the Tooltip OR
el <HTMLElement> The element representing the Tooltip
userConfig <Object> The configuration object literal containing the configuration that should be set for this Overlay. See configuration documentation for more details.

Properties

showProcId - int

The unique process ID associated with the thread responsible for showing the Tooltip.

YAHOO.widget.Tooltip._DEFAULT_CONFIG - private final Object

Constant representing the Tooltip's configuration properties

YAHOO.widget.Tooltip.CSS_TOOLTIP - static final String

Constant representing the Tooltip CSS class

Methods

_removeEventListeners

protected void _removeEventListeners ( )
Removes all of the DOM event handlers from the HTML element(s) that trigger the display of the tooltip.
Returns: void

configContainer

void configContainer ( type , args , obj )
The default event handler fired when the "container" property is changed.
Parameters:
type <String> The CustomEvent type (usually the property name)
args <Object[]> The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
obj <Object> The scope object. For configuration handlers, this will usually equal the owner.
Returns: void

configContext

void configContext ( type , args , obj )
The default event handler fired when the "context" property is changed.
Parameters:
type <String> The CustomEvent type (usually the property name)
args <Object[]> The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
obj <Object> The scope object. For configuration handlers, this will usually equal the owner.
Returns: void

configText

void configText ( type , args , obj )
The default event handler fired when the "text" property is changed.
Parameters:
type <String> The CustomEvent type (usually the property name)
args <Object[]> The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
obj <Object> The scope object. For configuration handlers, this will usually equal the owner.
Returns: void

destroy

void destroy ( )
Removes the Tooltip element from the DOM and sets all child elements to null.
Returns: void

doHide

void doHide ( )
Sets the timeout for the auto-dismiss delay, which by default is 5 seconds, meaning that a tooltip will automatically dismiss itself after 5 seconds of being displayed.
Returns: void

doShow

Number doShow ( e )
Processes the showing of the Tooltip by setting the timeout delay and offset of the Tooltip.
Parameters:
e <DOMEvent> The current DOM event
Returns: Number
The process ID of the timeout function associated with doShow

init

void init ( el , userConfig )
The Tooltip initialization method. This method is automatically called by the constructor. A Tooltip is automatically rendered by the init method, and it also is set to be invisible by default, and constrained to viewport by default as well.
Parameters:
el <String> The element ID representing the Tooltip OR
el <HTMLElement> The element representing the Tooltip
userConfig <Object> The configuration object literal containing the configuration that should be set for this Tooltip. See configuration documentation for more details.
Returns: void

initDefaultConfig

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

onContextMouseMove

void onContextMouseMove ( e , obj )
The default event handler fired when the user moves the mouse while over the context element.
Parameters:
e <DOMEvent> The current DOM event
obj <Object> The object argument
Returns: void

onContextMouseOut

void onContextMouseOut ( e , obj )
The default event handler fired when the user mouses out of the context element.
Parameters:
e <DOMEvent> The current DOM event
obj <Object> The object argument
Returns: void

onContextMouseOver

void onContextMouseOver ( e , obj )
The default event handler fired when the user mouses over the context element.
Parameters:
e <DOMEvent> The current DOM event
obj <Object> The object argument
Returns: void

preventOverlay

void preventOverlay ( pageX , pageY )
Fired when the Tooltip is moved, this event handler is used to prevent the Tooltip from overlapping with its context element.
Parameters:
pageX <Number> The x coordinate position of the mouse pointer
pageY <Number> The y coordinate position of the mouse pointer
Returns: void

toString

String toString ( )
Returns a string representation of the object.
Returns: String
The string representation of the Tooltip

Configuration Attributes

autodismissdelay - Number

The number of milliseconds to wait before automatically dismissing a Tooltip after the mouse has been resting on the context element.
Default Value: 5000

container - HTMLElement/String

Specifies the container element that the Tooltip's markup should be rendered into.
Default Value: document.body

context - HTMLElement[]/String[]

Specifies the element or elements that the Tooltip should be anchored to on mouseover.
Default Value: null

hidedelay - Number

The number of milliseconds to wait before hiding a Tooltip on mouseover.
Default Value: 250

preventoverlap - Boolean

Specifies whether the Tooltip should be kept from overlapping its context element.
Default Value: true

showdelay - Number

The number of milliseconds to wait before showing a Tooltip on mouseover.
Default Value: 200

text - String

Specifies the Tooltip's text.
Default Value: null

Configuration attributes inherited from YAHOO.widget.Module:

Configuration attributes inherited from YAHOO.widget.Overlay:


Copyright © 2007 Yahoo! Inc. All rights reserved.