Tooltip2
Tooltip2 is a JavaScript for creating Tooltips.
Documentation
Documentation can be found here: Tooltip2@Lubyte.de
Examples
new Tooltip2(
// the tooltip (create on dynamicly)
document.getElementById('tooltip'),
// the element which the tooltip is appended to
document.getElementById('element_with_tooltip')
); var tt = new Tooltip2(...);
tt.type = {
margin : [0,0,0,0], // margin relative to mouse (top, right, bottom, left)
gap : [0,0,0,0], // gap to browser window
direction : { // the default direction the tooltip is shown
x : 1, // 0 = left, 1 = right
y : 0 // 0 = bottom, 1 = top
}
} [...]
tt.type.margin = [21,21,21,15]; /* set gap to the mouse
this is how you can easily change values of type definition */
tt.fade = 1; // fadeing (1=fade in, 2=fade out, 3=both)
tt.hideAfter = 3000; // hide after x milli seconds
tt.dependent = 0; // show only one tooltip at time
tt.showOnEvent('mouseover'); // show when mouse over the appended element
tt.hideOnEvent('mouseout'); // hide when mouse out the appendes element
tt.updateOnEvent('resize', window); // update position, when window is resized
tt.show(); // show the tooltip
window.onunload = function () {
tt.hide();
} /* when page is unloaded, hide
same as tt.hideOnEvent('unload', window); */Requirements
Tooltip2 requires only addEvent() by Dão Gottwald. All other functions are included with the distribution.
Download
Download Tooltip2-2.4.2.zip (includes example, required functions, addEvent(), additional functions [getElementsByClassName, Array.prototype.indexOf])
License
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
Published at: August 10, 2010 – Last change: August 10, 2010
