Skip to content

Instantly share code, notes, and snippets.

@avargas
Created June 15, 2012 04:20
Show Gist options
  • Save avargas/2934652 to your computer and use it in GitHub Desktop.
Save avargas/2934652 to your computer and use it in GitHub Desktop.
CSS:
#preview-foot {
position:absolute;
border:1px solid #ccc;
background:#333;
padding:5px;
display:none;
color:#fff;
}
$(document).ready(function () {
var $each = $('ul.thumbprem a');
$each.hover(function(e) {
var url = $(this).find('img').attr('href').replace(/\.jpg$/, /\-big\.jpg/);
$("body").append("<div id='preview-foot'><img src='"+ url +"' /></div>");
$("#preview-foot")
.css("top", (e.pageY - xOffset) + "px")
.css("left", (e.pageX + yOffset) + "px")
.fadeIn("fast");
},
function(){
$("#preview").remove();
});
$each.mousemove(function(e){
$("#preview-image")
.css("top",(e.pageY - xOffset) + "px")
.css("left",(e.pageX + yOffset) + "px");
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment