Hi geeks,
I am stuck in a JavaScript function. Actually when we take a mouse over the picture it shows tooltip (image and title text). The href is path to the location of image. But what i want to show the tooltip (image and title text) as well as to set the href path to detail page link. I am unable to customized it. Can somebody help me out to fix this issue.
Here is my HTML code
here is Javascript file
here is the LIVE URL
If some one fixed this issue, i will be very grateful to him/her.
Thanks in advance
I am stuck in a JavaScript function. Actually when we take a mouse over the picture it shows tooltip (image and title text). The href is path to the location of image. But what i want to show the tooltip (image and title text) as well as to set the href path to detail page link. I am unable to customized it. Can somebody help me out to fix this issue.
Here is my HTML code
Code:
<table width="100%" border="0" cellspacing="3" cellpadding="3">
<tr><td align="left" valign="middle"><a href="http://bytes.com/images/products/1207730720_lillies.jpg" class="preview" title="Bunch of Lillies"><img src="http://bytes.com/images/products/1207730720_lillies.jpg" width="75" height="75" alt="Bunch of Lillies" class="img-border" /></a></td></tr>
<tr><td><a href="products/flowers/bunch-of-lillies" title="Details" class="normal">Bunch of Lillies</a></td></tr>
</table>
Code:
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.preview").hover(function(e){
this.t = this.title;
this.title = "";
var c = (this.t != "") ? "<br /><br />" + this.t : "";
$("body").append("<p id='preview'><img src='"+ this.href +"' alt='Image preview' />"+ c +"</p>");
$("#preview")
.css("top",(e.pageY - xOffset) + "px")
.css("left",(e.pageX + yOffset) + "px")
.fadeIn("fast");
},
function(){
this.title = this.t;
$("#preview").remove();
});
$("a.preview").mousemove(function(e){
$("#preview")
.css("top",(e.pageY - xOffset) + "px")
.css("left",(e.pageX + yOffset) + "px");
});
};
Code:
#preview{
border-radius:5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
position:absolute;
border:1px solid #ccc;
background:#333;
padding:10px;
display:none;
color:#fff;
}
If some one fixed this issue, i will be very grateful to him/her.
Thanks in advance
Comment