123456789101112$(function() {$("img").bind("mousemove", function() {//计算var x = event.offsetX / $(this).width();var y = event.offsetY / $(this).height();console.info(x + ":" + y);$("span").scrollLeft($("#img2").width() * x);$("span").scrollTop($("#img2").height() * y);})})
精简了放大镜的代码,提高了代码效率