/** * * simpleTooltip jQuery plugin, by Marius ILIE * visit http://dev.mariusilie.net for details * **/ var showing=0; (function($){ $.fn.simpletooltip = function(){ return this.each(function() { var text = $(this).attr("title"); $(this).attr("title", ""); if(text != undefined) { if (showing==0){ $(this).attr("title", ""); $("body").append(""); var tipWidth = $(".qtip").width() $(".qtip").width(tipWidth); showing=1; } $(this).hover(function(e){}, function(){ $(".qtip").remove(); if(text != undefined&&text!='') { $(this).attr("title", text); } showing=0; }); $(this).mousemove(function(e){ var tipX = e.pageX + 12; var tipY = e.pageY + 12; var tipWidth = $(".qtip").outerWidth(true); var tipHeight = $(".qtip").outerHeight(true); if(tipX + tipWidth > $(window).scrollLeft() + $(window).width()) tipX = e.pageX - tipWidth; if($(window).height()+$(window).scrollTop() < tipY + tipHeight) tipY = e.pageY - tipHeight; $(".qtip").css("left", tipX).css("top", tipY).fadeIn("medium"); }); } }); }})(jQuery);