I have found this script that expand image when mouse is over, but when click the image, open the image in a new page.
I would like modify the script because I don’t want that image open in new page when click.
How I can modify the script to not open the photo in new page?
This is the script:
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/>" + 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");
});
};
// starting the script on page load
$(document).ready(function(){
imagePreview();
});
To see the demo: http://cssglobe.com/lab/tooltip/02/
Thanks
Regards
To have all previews to occur at the same position, change the coordinates in these lines
Write the coordinate that you want in place of
e.pageY - xOffsetande.pageX + yOffset