lybovy12,
https://jsfiddle.net/jp98deb5/
var magnify = function(e) {
var ratio = native_width / cur_img.width() > 1.2 ? 1 : cur_img.width() / native_width * 2.7;
var rx = Math.round(mouse.x / cur_img.width() * native_width * ratio - ui.glass.width() / 2) * -1;
var ry = Math.round(mouse.y / cur_img.height() * native_height * ratio - ui.glass.height() / 2) * -1;
var bg_pos = rx + "px " + ry + "px";
var glass_left = e.pageX - ui.glass.width() / 2;
var glass_top = e.pageY - ui.glass.height() / 2;
ui.glass.css({
left: glass_left,
top: glass_top,
backgroundPosition: bg_pos,
backgroundSize: native_width * ratio + "px " + native_height * ratio + "px"
});
return
};