// Pedlr.com - adapted from doItLater.com to jQuery function toolTips(){ this._mousePosX = 0; this._mousePosY = 0; this._toolTip = null; this._tipContent = null; } toolTips.prototype.init = function(){ var tt = this; var toolTipInfo = $('.thumbnail').each( function(){ $(this).bind('mousemove', function(e){ if(!e){var e = window.event;} if(e.pageX || e.pageY){ tt.mousePosX = e.pageX; tt.mousePosY = e.pageY; } else if (e.clientX || e.clientY) { tt.mousePosX = e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft); tt.mousePosY = e.clientY + (document.documentElement.scrollTop || document.body.scrollTop); } tt._toolTip = this; tt._tipContent = document.getElementById(this.id+'_toolTip'); tt.move(); }); $(this).bind('mouseout', function (e){tt.out();}); } ); } toolTips.prototype.out = function(){ this._tipContent.style.top = -10000+'px'; this._tipContent.style.left = -10000+'px'; this._toolTip = null; this._tipContent = null; } toolTips.prototype.move = function(){ var x = this.mousePosX; var y = this.mousePosY; xOffset = (-180); yOffset = 10; if((x+xOffset) < 0){x = (0 - xOffset);} // keeps the left side of the bubbles on the page if((y+yOffset) < 0){y = (0 - yOffset);} // keeps the top of the bubbles on the page (they can still hang off the bottom at the moment) this._tipContent.style.top = y+10+'px'; this._tipContent.style.left = x-180+'px'; } $(document).ready(function(){ var tip = new toolTips(); tip.init(); // HACK: Make the toolTips have an opacity setting without using the invalid 'filter' attribute inside the CSS files. if($.browser.msie){ var opacity = $('blockquote.toolTip').css('-moz-opacity'); opacity *= 100; // turn it into a whole number instead of a decimal $('blockquote.toolTip').css('filter', 'alpha(opacity='+opacity+')'); } });