xTooltipGroup Demo

xTooltipGroup provides for multiple groups of tooltips. For each group you create two style classes. One is applied to all elements which will trigger the tooltip. The other specifies the tooltip style for the group. The tooltip takes its text from the element's TITLE attribute - or you provide an array of strings.

There are four different tooltip groups on this demo page: Group 1, Group 2, Group 3, and Group 4. Tooltip size and styling is controlled by the tipClass argument. Tooltip positioning is controlled by the origin and offset arguments.

The xTooltipGroup Object

View xTooltipGroup source and documentation.

Syntax

new xTooltipGroup(grpClassOrIdList, tipClass, origin, xOffset, yOffset, textList)

Parameters

grpClassOrIdList - The css class name which you add to any element you want to trigger a tooltip - Or - an array of id strings.

tipClass - The css class name applied to the tooltip triggered by elements with the grpClass class name (or elements whose id is in the IdList).

origin - One of 'right', 'top', or 'mouse'. For 'right' or 'top', the tooltip is positioned to the right (or top) of the trigger element. For 'mouse' the tooltip will follow the mouse. In all three cases the following offsets are applied.

xOffset, yOffset - The tooltip is positioned relative to the above origin, offset by these amounts.

hideDelay - After the mouse moves off of the trigger, this delay (in ms) will elapse before hiding the tip.

sticky - If true the tip will not be hidden until there is a click on the tip or a mouseover on some other trigger.

textList - If grpClassOrIdList is an array of IDs, then textList provides the tooltip text for the corresponding array index. If grpClassOrIdList is a class name then textList is not needed (tooltip text is taken from the element's TITLE attribute).

Usage

The following shows how the four tooltip groups on this page are initialized.

window.onload = function()
{
  new xTooltipGroup('tipGrp1', 'tipGrp1s', 'right', 4, 0, 1000, false);
  new xTooltipGroup('tipGrp2', 'tipGrp2s', 'top', 0, -2, 500, false);
  new xTooltipGroup('tipGrp3', 'tipGrp3s', 'mouse', 20, -10, 0, false);
  new xTooltipGroup(['p0','p1','p2','p3','p4','p5','p6','p7','td1','d1'],
                    'tipGrp4s', 'right', 4, 0, 0, true,
                    ["<p><b>heading</b></p><p>text</p>",
                    "<p><b>heading</b></p><p>text</p>",
                    "<p><b>heading</b></p><p>text</p>",
                    "<p><b>heading</b></p><p>text</p>",
                    "<p><b>heading</b></p><p>text</p>",
                    "<p><b>heading</b></p><p>text</p>",
                    "<p><b>heading</b></p><p>text</p>",
                    "<p><b>heading</b></p><p>text</p>",
                    "<p><b>heading</b></p><p>text</p>",
                    "<p><b>heading</b></p><p>text</p>"]);
}

Container Test

This tests assigning a tooltip to an element that has child elements.

[td1: a div and a span ]
[ a div and a span ]
d1:
div span   i a

Last Update

17 Feb 07

Sed ut perspiciatis...

Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?

Ant Macros for X

I use this at work and it is very useful. Read more about the X Tools.

Mike's Other Stuff

Where Mike Works

Friends