I had no reason to write a weblog until today that I wrote a Tooltip creator and i wanted to publish it.
Its too small to have a homepage or something like that, so I thought best place for such thing is a weblog.
My Javascript skills are so limited.So probably you could find many 'WTF's in it.
Using it is rather easy:
T = new Tooltip( 'ActivatorId', 'TooltipId' );
T.Register();
Activator is the element that Tooltip will show up when its hovered.
this Tooltip is customizable and has many other options:
T = new Tooltip( 'Activator', 'Tooltip' );
T.ShowEvent = 'mouseover';
T.ShowEffect = Effect.Grow;
T.HideEvent = 'click';
T.HideEffect = Effect.Puff;
T.AutoHide = 7; //Autohides tooltip after 7 seconds
T.HideOthers = true; //If its true, each time this tooltip opens, other ones will be closed
T.HideOnClick = true;
T.FollowMouse = true; //Open where the cursor is
T.StickToMouse = false; //always follows the mouse
T.AjaxUrl = false; //Change it to your Ajax requests url to load contents dynamically
T.Register();
Its released under GPL 2 (or any newer version released by FSF).
I tested it on Konqueror and Firefox 2.0.
Its based on Prototype.if you have Scriptaculous, Effect.Grow and Effect.Puff will be used for Showing/Hiding it ( Sure you can change this using ShowEffect and HideEffect )
It fires the following events:
Tooltip:Opened
Tooltip:Closed
Tooltip:AjaxRequestCreated
Tooltip:AjaxRequestCompleted
My English sucks.Sorry if there is any mistake.
| Attachment | Size |
|---|---|
| Tooltip.js.txt | 4.21 KB |