| Version 1 (modified by tiago.c.rodrigues, 3 years ago) |
|---|
[Elements] are optional
Class SAPO.Component.Tooltip
class
SAPO.Component.Tooltip
requires SAPO.Utility.Variable
requires Prototype
Defined in
Component/Tooltip/0.1/lib.jsInclusion link: http://js.sapo.pt/SAPO/Component/Tooltip/0.1/
Sample: http://js.sapo.pt/SAPO/Component/Tooltip/sample/
Constructor Summary
Renders a tooltip over a given element
Function Summary
Activates a tooltip over a given set of elements.
Remains public for compatibility purposes.
private
createHackIframe()
Creates the iframe for the iframe hack
init()
Initialization function. Called by the constructor and
receives the same parameters.
on mouse move event handler
on mouse out event handler
on mouse over event handler
sets the position of an element
Renders the content inside the tooltip
Constructor Details
constructor Tooltip
Tooltip(string|Array
element, Object
options)
Renders a tooltip over a given element
Parameters:
element
- Element id or an array of id's
options
- Options for the tooltip -
DOMElement|string template- An element which will be used as a template for the tooltip -
[ string where ]- where to show the tooltip: mousemove, left or right -
[ int zindex ]- the zindex of the tooltip -
[ boolean hasText ]- if the tooltip has any text -
[ string contentAttr ]- the attribute on the target element which holds the content for the tooltip -
[ string contentText ]- the content for the tooltip -
[ DOMElement|string contentElm ]- the element which holds the content -
[ int leftElm ]- left offset of the tooltip box from the mouse position -
[ int topElm ]- top offset of the tooltip box from the mouse position -
[ int delay ]- delay for the rendering of the tooltip -
[ boolean hasIframe ]- defines if the iframe hack should be used
Function Details
function activate
activate(string|Array
element, Object
options)
Activates a tooltip over a given set of elements.
Remains public for compatibility purposes.
Parameters:
element
- Element id or an array of id's
options
- Options for the tooltip (same as
the constructor) function createHackIframe
private
createHackIframe()
Creates the iframe for the iframe hack
function getMousePosition
private
Array
getMousePosition(Object
e)
Parameters:
e
- Event object
Returns:
The current mouse position
function getPageXY
private
Array
getPageXY()
Returns:
Page width and height
function getScroll
private
Array
getScroll()
Returns:
Page's scrollable width and height
function init
init()
Initialization function. Called by the constructor and
receives the same parameters.
function onMouseMove
private
onMouseMove(Object
e, int
index)
on mouse move event handler
Parameters:
e
- event object
index
- index of the element where the event is to be
applied on the list of elements which will have tooltips function onMouseOut
private
onMouseOut(Object
e, int
index)
on mouse out event handler
Parameters:
e
- event object
index
- index of the element where the event is to be
applied on the list of elements which will have tooltips function onMouseOver
private
onMouseOver(Object
e, int
index)
on mouse over event handler
Parameters:
e
- event object
index
- index of the element where the event is to be
applied on the list of elements which will have tooltips function setPosition
private
setPosition(int
index, int
left, int
top)
sets the position of an element
Parameters:
index
- index of the element where the position is to be
applied on the list of elements which will have tooltips
left
- left position
top
- top position function writeContent
private
writeContent(int
index)
Renders the content inside the tooltip
Parameters:
index
- index of the element where the event is to be
applied on the list of elements which will have tooltips