# DOM Tooltip Library HOWTO

### Usage

This library offers a variety of ways to enable custom tooltips. The standard way of creating a tooltip is to add the domTT_activate() call to one of the event handlers of the target element. Tips can also be created programatically, which can be used for popping up inline windows. Another option is to call the method domTT_replaceTitles(), which replaces all elements containing the class 'tooltip' and the title attribute with a custom toolitp on mouseover.

### Examples

    <a href="index.html" onmouseover="domTT_activate(this, event, 'content', 'My first tooltip', 'trail', true);">sample link</a>

### Options

The only required option to create a tooltip is the 'content' option. Most of the options below have a default value which is held in a global variable. If the option is specified, it overrides the default. The options are summarized below.

caption [text|xhtml]
  An auto-generated caption will be created if this text is present.
content [text|xhtml] (required)
  The main content of the tip, which may be XHTML text.
clearMouse [boolean]
  This option flags whether the tip should attempt to avoid the mouse when the direction is south.
closeAction ['hide'|'remove']
  Determines if the tip should be destroyed or just hidden when deactivated.
closeLink [text]
  The text that should be used for the auto-generated close link used for sticky tips.
delay [ms]
  Time in milliseconds before the tip appears.
direction ['southeast'|'southwest'|'northeast'|'northwest'|'north'|'south']
  The position of the tip relative to the mouse.
draggable [boolean]
  Determines of the sticky tooltip can be dragged.
fade ['in'|'out'|'neither'|'both']
  Sets the alpha effect when the tip is created or destroyed.
fadeMax [0-100]
  Sets the maximum alpha that should be used for the alpha effect.
grid [px]
  Snaps the trailing to a grid, so that the tip only moves after a set number of pixels.
id [string]
  The XML id that should be assigned to the tip. Using this setting allows for external manipulation of the tip.
inframe [boolean]
  Hints that the tooltip is inside an iframe, so that the tip can be manipulated from the parent frame.
lifetime [ms]
  The duration of time before the tooltip is automatically terminated.
offsetX [px]
  The left-to-right offset from the event where the tip should be placed.
offsetY [px]
  The top-to-bottom offset from the event where the tip should be placed.
parent [DOM Node]
  The parent node on which the tip should be appended. Usually used for tips with a relative position.
position ['absolute'|'relative'|'fixed']
  The style position of the tip.
predefined [string]
  An reference to a previously defined tooltip using domTT_addPredefined()
statusText [string]
  Sets the text to be used in the statusbar when the tip is activated. If used with mouseover, it is necessary to wrap the domTT_activate() call in 'return domTT_true()'.
styleClass [string]
  The class that will be assigned to the tip. The contents of the tip is assigned the class 'content' and the caption of the tip is assigned the class 'caption'.
type ['greasy'|'sticky'|'velcro']
  Sets the fate of the tip. A greasy tip disappears when a mouse out occurs on owner. A sticky tip stays active until explicitly destroyed. A velcro tip disappears when a mouse out occurs on the tip itself.
trail [true|false|'x'|'y']
  On which axis the tip should be updated when the mouse moves. A valud of true updates on both axes.
lazy [boolean]
  Whether or not to enable a delay when updating the mouse position of a trailing tip.
width [px]
  A manual width for the tip.
maxWidth [px]
  A manual maximum width for the tip.
x [px]
  The absolute x position to be used for the tip location. This can be a calculated value, such as 'this.offsetLeft + 5'.
y [px]
  The absolute y position to be used for the tip location. This can be a calculated value, such as 'this.offsetTop + 5'.