Hi,
I'm creating an image tooltip but for some reason I can't make it work as expected.
First here is the jquery file[mainx.js]:
this.screenshotPreview = function(){
xOffset = 5;
yOffset = 25;
$(".lFilename").hover(function(e){
this.t = this.title;
this.title = "";
var c = (this.t != "") ? "<br/>" + this.t : "";
$("body").append("<p id='lFilename'><img src='"+ this.CommandArgument +"' alt='url preview' />"+ c +"</p>");
$("#lFilename")
.css("top",(e.pageY - xOffset) + "px")
.css("left",(e.pageX + yOffset) + "px")
.fadeIn("fast");
},
function(){
this.title = this.t;
$("#lFilename").remove();
});
$(".lFilename").mousemove(function(e){
$("#lFilename")
.css("top",(e.pageY - xOffset) + "px")
.css("left",(e.pageX + yOffset) + "px");
});
};
$(document).ready(function(){
screenshotPreview();
});
Here's the ASP LinkButton located inside a gridview:
<ItemTemplate>
<asp:LinkButton runat="server" CssClass="lFilename" ID="grdlinkFilename" Text='<%#Eval("FILENAME")%>' CommandArgument='<%#Eval("FILEPATH")%>' OnCommand="grdlinkFilename_click"> </asp:LinkButton>
</ItemTemplate>
When I point my mouse over any file there's a pop up but all I see is "url preview" but no picture.
By the way this is part of the web application that I'm creating and this code is part of the page that recursively scan all the folders with all its sub-folders and files in the server's D drive. So all the image files are located in the server's D: drive.
Please help me with this.
Update:
I also tried this (Added variable locat and use it as an argument):
var locat = "d:\sample pix\android.jpg";
this.screenshotPreview = function(){
xOffset = 5;
yOffset = 25;
$(".lFilename").hover(function(e){
this.t = this.title;
this.title = "";
var c = (this.t != "") ? "<br/>" + this.t : "";
$("body").append("<p id='lFilename'><img src='"+ locat +"' alt='url preview' />"+ c +"</p>");
$("#lFilename")
.css("top",(e.pageY - xOffset) + "px")
.css("left",(e.pageX + yOffset) + "px")
.fadeIn("fast");
},
function(){
this.title = this.t;
$("#lFilename").remove();
});
$(".lFilename").mousemove(function(e){
$("#lFilename")
.css("top",(e.pageY - xOffset) + "px")
.css("left",(e.pageX + yOffset) + "px");
});
};
but still no luck.