Hover over the orange box and the link to see their Tooltips.
Hover over me to see a Tooltip!
The Tooltip Control is an extension of Overlay that is analogous to popup tooltips within common operating systems. The standard tooltip interaction pattern involves a small overlay that is displayed when the mouse hovers over a context element for a specified amount of time. Tooltip is designed to be simple to implement with easily-accessed configuration options and visual styling handled entirely via CSS.
Tooltips are instantiated by script and are rendered (and hidden) automatically when the window's load
event fires; unlike other controls in the Container family, no call to render
is required with Tooltip. Tooltip introduces several specific configuration properties:
In this tutorial, we'll create two Tooltips. The first will be associated with an element with an id of ctx
, and will have its text set explicitly. The second Tooltip will be associated with a link with an id of link
, but it will retrieve its text from the link's title
attribute:
1 | YAHOO.example.container.tt1 = new YAHOO.widget.Tooltip("tt1", |
2 | { context:"ctx", |
3 | text:"My text was set using the 'text' configuration property" }); |
4 | YAHOO.example.container.tt2 = new YAHOO.widget.Tooltip("tt2", { context:"link" }); |
view plain | print | ? |
The corresponding markup for the context elements for this tutorial looks like this:
1 | <div id="ctx">Hover over me to see a Tooltip!</div> |
2 | <a id="link" href="http://www.yahoo.com/" title="Do You Yahoo?">Hover over me to see a Tooltip!</a> |
view plain | print | ? |
You can load the necessary JavaScript and CSS for this example from Yahoo's servers. Click here to load the YUI Dependency Configurator with all of this example's dependencies preconfigured.
INFO 996ms (+0) 12:56:27 AM:
Config
Config event queue: monitorresize=true, appendtodocumentbody=false, fixedcenter=false, autofillheight=body, zindex=null, preventcontextoverlap=false, preventoverlap=true, showdelay=200, autodismissdelay=5000, hidedelay=250, container=[object HTMLBodyElement], disabled=false, context=link, visible=false, constraintoviewport=true, iframe=false,
INFO 996ms (+0) 12:56:27 AM:
Config
queueProperty: constraintoviewport=true
INFO 996ms (+0) 12:56:27 AM:
Config
Config event queue: monitorresize=true, appendtodocumentbody=false, fixedcenter=false, autofillheight=body, zindex=null, preventcontextoverlap=false, constraintoviewport=false, preventoverlap=true, showdelay=200, autodismissdelay=5000, hidedelay=250, container=[object HTMLBodyElement], disabled=false, context=link, iframe=false, visible=false,
INFO 996ms (+0) 12:56:27 AM:
Config
queueProperty: visible=false
INFO 996ms (+0) 12:56:27 AM:
Config
Config event queue: monitorresize=true, appendtodocumentbody=false, fixedcenter=false, visible=true, autofillheight=body, zindex=null, preventcontextoverlap=false, constraintoviewport=false, preventoverlap=true, showdelay=200, autodismissdelay=5000, hidedelay=250, container=[object HTMLBodyElement], disabled=false, context=link, iframe=false,
INFO 996ms (+0) 12:56:27 AM:
Config
queueProperty: context=link
INFO 996ms (+0) 12:56:27 AM:
Config
Config event queue: monitorresize=true, appendtodocumentbody=false, fixedcenter=false, visible=true, autofillheight=body, iframe=false, zindex=null, preventcontextoverlap=false, constraintoviewport=false, preventoverlap=true, showdelay=200, autodismissdelay=5000, hidedelay=250, container=[object HTMLBodyElement], disabled=false,
INFO 996ms (+0) 12:56:27 AM:
Config
queueProperty: disabled=false
INFO 996ms (+0) 12:56:27 AM:
Config
setProperty: disabled=false
INFO 996ms (+0) 12:56:27 AM:
Config
Added property: disabled
INFO 996ms (+0) 12:56:27 AM:
Config
Config event queue: monitorresize=true, appendtodocumentbody=false, fixedcenter=false, visible=true, autofillheight=body, iframe=false, zindex=null, preventcontextoverlap=false, constraintoviewport=false, preventoverlap=true, showdelay=200, autodismissdelay=5000, hidedelay=250, container=[object HTMLBodyElement],
INFO 996ms (+0) 12:56:27 AM:
Config
queueProperty: container=[object HTMLBodyElement]
INFO 996ms (+0) 12:56:27 AM:
Config
setProperty: container=[object HTMLBodyElement]
INFO 996ms (+0) 12:56:27 AM:
Config
Added property: container
INFO 996ms (+0) 12:56:27 AM:
Config
setProperty: text=undefined
INFO 996ms (+0) 12:56:27 AM:
Config
Added property: text
INFO 996ms (+0) 12:56:27 AM:
Config
Config event queue: monitorresize=true, appendtodocumentbody=false, fixedcenter=false, visible=true, autofillheight=body, iframe=false, zindex=null, preventcontextoverlap=false, constraintoviewport=false, preventoverlap=true, showdelay=200, autodismissdelay=5000, hidedelay=250,
INFO 996ms (+0) 12:56:27 AM:
Config
queueProperty: hidedelay=250
INFO 996ms (+0) 12:56:27 AM:
Config
setProperty: hidedelay=250
INFO 996ms (+0) 12:56:27 AM:
Config
Added property: hidedelay
INFO 996ms (+0) 12:56:27 AM:
Config
Config event queue: monitorresize=true, appendtodocumentbody=false, fixedcenter=false, visible=true, autofillheight=body, iframe=false, zindex=null, preventcontextoverlap=false, constraintoviewport=false, preventoverlap=true, showdelay=200, autodismissdelay=5000,
INFO 996ms (+0) 12:56:27 AM:
Config
queueProperty: autodismissdelay=5000
INFO 996ms (+0) 12:56:27 AM:
Config
setProperty: autodismissdelay=5000
INFO 996ms (+0) 12:56:27 AM:
Config
Added property: autodismissdelay
INFO 996ms (+0) 12:56:27 AM:
Config
Config event queue: monitorresize=true, appendtodocumentbody=false, fixedcenter=false, visible=true, autofillheight=body, iframe=false, zindex=null, preventcontextoverlap=false, constraintoviewport=false, preventoverlap=true, showdelay=200,
INFO 996ms (+0) 12:56:27 AM:
Config
queueProperty: showdelay=200
INFO 996ms (+0) 12:56:27 AM:
Config
setProperty: showdelay=200
INFO 996ms (+0) 12:56:27 AM:
Config
Added property: showdelay
INFO 996ms (+0) 12:56:27 AM:
Config
Config event queue: monitorresize=true, appendtodocumentbody=false, fixedcenter=false, visible=true, autofillheight=body, iframe=false, zindex=null, preventcontextoverlap=false, constraintoviewport=false, preventoverlap=true,
INFO 996ms (+0) 12:56:27 AM:
Config
queueProperty: preventoverlap=true
INFO 996ms (+0) 12:56:27 AM:
Config
setProperty: preventoverlap=true
INFO 996ms (+0) 12:56:27 AM:
Config
Added property: preventoverlap
INFO 996ms (+0) 12:56:27 AM:
Config
Config event queue: monitorresize=true, appendtodocumentbody=false, fixedcenter=false, visible=true, autofillheight=body, iframe=false, zindex=null, preventcontextoverlap=false, constraintoviewport=false,
INFO 996ms (+0) 12:56:27 AM:
Config
queueProperty: preventcontextoverlap=false
INFO 996ms (+0) 12:56:27 AM:
Config
setProperty: preventcontextoverlap=false
INFO 996ms (+0) 12:56:27 AM:
Config
Added property: preventcontextoverlap
INFO 996ms (+0) 12:56:27 AM:
Config
Config event queue: monitorresize=true, appendtodocumentbody=false, fixedcenter=false, visible=true, autofillheight=body, constraintoviewport=false, iframe=false, zindex=null,
INFO 996ms (+0) 12:56:27 AM:
Config
queueProperty: iframe=false
INFO 996ms (+0) 12:56:27 AM:
Config
setProperty: iframe=false
INFO 996ms (+0) 12:56:27 AM:
Config
Added property: iframe
INFO 996ms (+0) 12:56:27 AM:
Config
Config event queue: monitorresize=true, appendtodocumentbody=false, fixedcenter=false, visible=true, autofillheight=body, zindex=null, constraintoviewport=false,
INFO 996ms (+0) 12:56:27 AM:
Config
queueProperty: constraintoviewport=false
INFO 996ms (+0) 12:56:27 AM:
Config
setProperty: constraintoviewport=false
INFO 996ms (+0) 12:56:27 AM:
Config
Added property: constraintoviewport
INFO 996ms (+0) 12:56:27 AM:
Config
Config event queue: monitorresize=true, appendtodocumentbody=false, fixedcenter=false, visible=true, autofillheight=body, zindex=null,
INFO 996ms (+0) 12:56:27 AM:
Config
queueProperty: zindex=null
INFO 996ms (+0) 12:56:27 AM:
Config
setProperty: zindex=null
INFO 996ms (+0) 12:56:27 AM:
Config
Added property: zindex
INFO 996ms (+0) 12:56:27 AM:
Config
Config event queue: monitorresize=true, appendtodocumentbody=false, fixedcenter=false, visible=true, autofillheight=body,
INFO 996ms (+0) 12:56:27 AM:
Config
queueProperty: autofillheight=body
INFO 996ms (+0) 12:56:27 AM:
Config
setProperty: autofillheight=body
INFO 996ms (+0) 12:56:27 AM:
Config
Added property: autofillheight
INFO 996ms (+0) 12:56:27 AM:
Config
setProperty: height=undefined
INFO 996ms (+0) 12:56:27 AM:
Config
Added property: height
INFO 996ms (+0) 12:56:27 AM:
Config
setProperty: width=undefined
INFO 996ms (+0) 12:56:27 AM:
Config
Added property: width
INFO 996ms (+0) 12:56:27 AM:
Config
Config event queue: monitorresize=true, appendtodocumentbody=false, fixedcenter=false, visible=true,
INFO 996ms (+0) 12:56:27 AM:
Config
queueProperty: fixedcenter=false
INFO 996ms (+0) 12:56:27 AM:
Config
setProperty: fixedcenter=false
INFO 996ms (+0) 12:56:27 AM:
Config
Added property: fixedcenter
INFO 996ms (+0) 12:56:27 AM:
Config
setProperty: context=undefined
INFO 996ms (+0) 12:56:27 AM:
Config
Added property: context
INFO 996ms (+0) 12:56:27 AM:
Config
setProperty: xy=undefined
INFO 996ms (+0) 12:56:27 AM:
Config
Added property: xy
INFO 996ms (+0) 12:56:27 AM:
Config
setProperty: y=undefined
INFO 996ms (+0) 12:56:27 AM:
Config
Added property: y
INFO 996ms (+0) 12:56:27 AM:
Config
setProperty: x=undefined
INFO 996ms (+0) 12:56:27 AM:
Config
Added property: x
INFO 996ms (+0) 12:56:27 AM:
Config
Config event queue: visible=true, monitorresize=true, appendtodocumentbody=false,
INFO 996ms (+0) 12:56:27 AM:
Config
queueProperty: appendtodocumentbody=false
INFO 996ms (+0) 12:56:27 AM:
Config
setProperty: appendtodocumentbody=false
INFO 996ms (+0) 12:56:27 AM:
Config
Added property: appendtodocumentbody
INFO 996ms (+0) 12:56:27 AM:
Config
Config event queue: visible=true, monitorresize=true,
INFO 996ms (+0) 12:56:27 AM:
Config
queueProperty: monitorresize=true
INFO 996ms (+0) 12:56:27 AM:
Config
setProperty: monitorresize=true
INFO 996ms (+0) 12:56:27 AM:
Config
Added property: monitorresize
INFO 996ms (+0) 12:56:27 AM:
Config
setProperty: effect=undefined
INFO 996ms (+0) 12:56:27 AM:
Config
Added property: effect
INFO 996ms (+0) 12:56:27 AM:
Config
Config event queue: visible=true,
INFO 996ms (+0) 12:56:27 AM:
Config
queueProperty: visible=true
INFO 996ms (+0) 12:56:27 AM:
Config
setProperty: visible=true
INFO 996ms (+0) 12:56:27 AM:
Config
Added property: visible
INFO 996ms (+0) 12:56:27 AM:
Config
Config event queue: monitorresize=true, appendtodocumentbody=false, fixedcenter=false, autofillheight=body, zindex=null, preventcontextoverlap=false, preventoverlap=true, showdelay=200, autodismissdelay=5000, hidedelay=250, container=[object HTMLBodyElement], disabled=false, context=ctx, text=My text was set using the 'text' configuration property, visible=false, constraintoviewport=true, iframe=false,
INFO 996ms (+0) 12:56:27 AM:
Config
queueProperty: constraintoviewport=true
INFO 996ms (+0) 12:56:27 AM:
Config
Config event queue: monitorresize=true, appendtodocumentbody=false, fixedcenter=false, autofillheight=body, zindex=null, preventcontextoverlap=false, constraintoviewport=false, preventoverlap=true, showdelay=200, autodismissdelay=5000, hidedelay=250, container=[object HTMLBodyElement], disabled=false, context=ctx, iframe=false, text=My text was set using the 'text' configuration property, visible=false,
INFO 996ms (+0) 12:56:27 AM:
Config
queueProperty: visible=false
INFO 996ms (+0) 12:56:27 AM:
Config
Config event queue: monitorresize=true, appendtodocumentbody=false, fixedcenter=false, visible=true, autofillheight=body, zindex=null, preventcontextoverlap=false, constraintoviewport=false, preventoverlap=true, showdelay=200, autodismissdelay=5000, hidedelay=250, container=[object HTMLBodyElement], disabled=false, context=ctx, iframe=false, text=My text was set using the 'text' configuration property,
INFO 996ms (+0) 12:56:27 AM:
Config
queueProperty: text=My text was set using the 'text' configuration property
INFO 996ms (+0) 12:56:27 AM:
Config
Config event queue: monitorresize=true, appendtodocumentbody=false, fixedcenter=false, visible=true, autofillheight=body, zindex=null, preventcontextoverlap=false, constraintoviewport=false, preventoverlap=true, showdelay=200, autodismissdelay=5000, hidedelay=250, container=[object HTMLBodyElement], disabled=false, context=ctx, iframe=false,
INFO 996ms (+0) 12:56:27 AM:
Config
queueProperty: context=ctx
INFO 996ms (+0) 12:56:27 AM:
Config
Config event queue: monitorresize=true, appendtodocumentbody=false, fixedcenter=false, visible=true, autofillheight=body, iframe=false, zindex=null, preventcontextoverlap=false, constraintoviewport=false, preventoverlap=true, showdelay=200, autodismissdelay=5000, hidedelay=250, container=[object HTMLBodyElement], disabled=false,
INFO 996ms (+0) 12:56:27 AM:
Config
queueProperty: disabled=false
INFO 996ms (+0) 12:56:27 AM:
Config
setProperty: disabled=false
INFO 996ms (+0) 12:56:27 AM:
Config
Added property: disabled
INFO 996ms (+1) 12:56:27 AM:
Config
Config event queue: monitorresize=true, appendtodocumentbody=false, fixedcenter=false, visible=true, autofillheight=body, iframe=false, zindex=null, preventcontextoverlap=false, constraintoviewport=false, preventoverlap=true, showdelay=200, autodismissdelay=5000, hidedelay=250, container=[object HTMLBodyElement],
INFO 995ms (+0) 12:56:27 AM:
Config
queueProperty: container=[object HTMLBodyElement]
INFO 995ms (+0) 12:56:27 AM:
Config
setProperty: container=[object HTMLBodyElement]
INFO 995ms (+0) 12:56:27 AM:
Config
Added property: container
INFO 995ms (+0) 12:56:27 AM:
Config
setProperty: text=undefined
INFO 995ms (+995) 12:56:27 AM:
Config
Added property: text
Note: You are viewing this example in debug mode with logging enabled. This can significantly slow performance.
Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Copyright Policy - Job Openings