/* * image preview script * powered by jquery (http://www.jquery.com) * * written by alen grakalic (http://cssglobe.com) * * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery * */ this.imagepreview = function(){ /* config */ xoffset = 10; yoffset = 30; // these 2 variable determine popup's distance from the cursor // you might want to adjust to get the right result /* end config */ $("a.preview1").hover(function(e){ this.t = this.title; this.title = ""; var c = (this.t != "") ? "
" + this.t : ""; $("body").append("

image preview1"+ c +"

"); $("#preview1") .css("top",(e.pagey - xoffset) + "px") .css("left",(e.pagex + yoffset) + "px") .fadein("fast"); }, function(){ this.title = this.t; $("#preview1").remove(); }); $("a.preview1").mousemove(function(e){ $("#preview1") .css("top",(e.pagey - xoffset) + "px") .css("left",(e.pagex + yoffset) + "px"); }); }; // starting the script on page load $(document).ready(function(){ imagepreview(); });