Updated on Sat 29 Oct: Dustin altered his script to position tooltips according to mouse position, as well as adding tooltips for acronym and abbr elements. ProtoTip has been updated accordingly. You now no longer need to call the attachToolTip function yourself, as a call to it has been added to window's onload event in prototip.js.
A Prototype based version of Dustin Diaz's most excellent Sweet Titles library.
All credit to Dustin on this one - this is just a simple port.
Download:
- prototip.js (packed) or prototip.js (source)
- prototip.css - tooltip stylesheet
- prototype.js (packed)
Features
Nothing new feature-wise over what Dustin already had in there. In other words, when you call the library's attach function, all links on the page will have their URLs and (if available) titles displayed in a nifty tooltipular manner when you mouse over them.
This version simply uses Prototype methods rather than those supplied in the extra files provided with Dustin's version. As such, if you're already using Prototype, you can drop this right in.
In addition, you may safely call attachToolTipBehavior() multiple times in this version.
Usage
Include ProtoTip and the tooltip stylesheet in your page. If you already have Prototype available, all you need to do is add a call to ProtoTip.attachToolTipBehavior() somewhere where it will get called when the onload event for your page fires.
Here's a rather simple way to do that:
window.onload = function()
{
ProtoTip.attachToolTipBehavior();
}See Dustin's Sweet Titles page if you require more detailed instructions.
Dependencies
Reference
| Method | Kind | Argument | Description |
|---|---|---|---|
| attachToolTipBehavior() | static | (none) | Attaches ProtoTip events to event handlers on all links on the page, unless they have already been processed by ProtoTip |
TODO
Determine when a tooltip will be displayed off the bottom or side of a page and reposition it.- Allow users to select classes and attributes for tooltipification when calling
attachToolTipBehavior()with cssQuery.