/* _________________________________________________________________________________________________ pz.tooltip _________________________________________________________________________________________________ version 0.02 -- new param in oSettings: _tooltipCSSClass _________________________________________________________________________________________________ */ jQuery.fn.pzTooltip = function(oSettings) { return this.each( function() { if(oSettings==undefined) oSettings={}; var _this = jQuery(this); var _title = _this.attr("title"); var _tooltipId = oSettings._tooltipId || "tooltip"; var _tooltipCSSClass = oSettings._tooltipCSSClass || "tooltip"; var _yOffset = oSettings._yOffset || 0; var _xOffset = oSettings._xOffset || 0; //-- hover: in = show / out = hide _this.hover(function(e){ _this.attr("title",""); $("body").append("
"+ _title +"
"); $("#"+_tooltipId) .css("left",(e.pageX + _xOffset) + "px") .css("top",(e.pageY + _yOffset) + "px") .fadeIn("fast"); }, function(){ _this.attr("title",_title); $("#"+_tooltipId).remove(); }); //-- click = hide _this.click(function(){ _this.attr("title",_title); $("#"+_tooltipId).remove(); }); //-- mouse move = move _this.mousemove(function(e){ $("#"+_tooltipId) .css("left",(e.pageX + _xOffset) + "px") .css("top",(e.pageY + _yOffset) + "px"); }); } ) };