On my page I use image preview links.
When you follow the link with the mouse, it displays a preview image.
Here is a demo: http://cssglobe.com/lab/tooltip/03/
I want to show gif loading during image loading.
Download gif: http://i.imgur.com/54cQB45.gif
here is my javascript code;
this.screenshotPreview = function(){
xOffset = 10;
yOffset = 30;
$("a.screenshot").hover(function(e){
this.t = this.title;
this.title = "";
var c = (this.t != "") ? "<br/>" + this.t : "";
$("body").append("<p id='screenshot'><img src='"+ this.rel +"' alt='url preview' />"+ c +"</p>");
$("#screenshot")
.css("top",(e.pageY - xOffset) + "px")
.css("left",(e.pageX + yOffset) + "px")
.fadeIn("fast");
},
function(){
this.title = this.t;
$("#screenshot").remove();
});
$("a.screenshot").mousemove(function(e){
$("#screenshot")
.css("top",(e.pageY - xOffset) + "px")
.css("left",(e.pageX + yOffset) + "px");
});
};
$(document).ready(function(){
screenshotPreview();
});
and html codes;
<a href="Link" class="screenshot" rel="image link">Link Name</a>
so how can i do this? Any ideas?
JacKy source
share