GeSHi (Javascript):
$(document).ready(function()
{
Function.prototype.deferOnce = function(scope, timeout, args)
{
var self = this;
var fn = function () {self.apply(scope || window, args || [])};
if (this.timeoutID)
clearTimeout(this.timeoutID);
this.timeoutID = setTimeout(fn, timeout);
return this.timeoutID;
}
Function.prototype.clearDeferOnce = function()
{
if (this.timeoutID)
clearTimeout(this.timeoutID);
this.timeoutID = null;
}
$("<div id= 'tip' class='tool_left'><div id='tip-inner' class='tool_right'></div></div>")
.css("position", "absolute")
.css("display", "none")
.appendTo("body");
var applyTooltip = function(event)
{
$("#tip-inner").html($(this).attr("rel"));
$("#tip").css("display", "block");
}
$(".tooltip").mousemove(function(event)
{
$("#tip").css("top", event.pageY + 10).css("left", event.pageX +10);
});
$(".tooltip").hover
(
function(event)
{
applyTooltip.deferOnce(this, 1000, [event]);
},
function()
{
applyTooltip.clearDeferOnce();
$("#tip").css("display", "none");
}
);
});
Има доста готови и добре написани tooltip plugin-и
Хвърли им едно око.