/** Vertigo Tip by www.vertigo-project.com Requires jQuery */ this.vtip = function() { this.xOffset = -10; // x distance from mouse this.yOffset = 10; // y distance from mouse var w = document.body.scrollWidth; var h = document.body.scrollHeight; //d.style.left = (w - document.all.tbl.clientWidth) / 2; //d.style.top = (h - document.all.tbl.clientHeight - 100) / 2; $(".vtip").unbind().hover( function(e) { this.t = this.title; this.title = ''; this.top = (e.pageY + yOffset); this.left = (e.pageX + xOffset); if (this.left > (w / 2) + 300) { this.left = (e.pageX + xOffset - 450); } //this.top = (h - 100) / 2; $('body').append('
' + this.t + '
'); $('p#vtip #vtipArrow').attr("src", 'http://www.csmu.edu.tw/ezcatfiles/w2/img/img/656/vtip_arrow.png'); $('p#vtip').css("top", this.top + "px").css("left", this.left + "px").slideDown("fast"); $('p#vtip').css("height", 500); $('p#vtip').css("width", 500); $('p#vtip').css("z-index", 0); }, function() { this.title = this.t; $("p#vtip").slideUp("fast").remove(); } ).mousemove( function(e) { // this.top = (h - 100) / 2; // this.left = (w / 2) - 300; this.top = (e.pageY); this.left = (e.pageX + 10); if (this.left > (w / 2) + 300) { //this.left = (w / 2) - 300; this.left = (e.pageX - 450); } $("p#vtip").css("top", this.top + "px").css("left", this.left + "px"); $('p#vtip').css("width", 500); } ); }; jQuery(document).ready(function($){vtip();})