Here is an example solution, but it requires you to make a couple of changes.
If you set the zoom square so that the background image is the same as the original image and adjust its background position on css as its negative position relative to the original image ... Am I explaining this correctly?
http://jsfiddle.net/moopet/Be9AA/
An important part
var left = Math.min(Math.max(relX - 100, 0), $origImg.width() - $zoomBox.width()), top = Math.min(Math.max(relY - 100, 0), $origImg.height() - $zoomBox.height()); $zoomBox.css({ left: left, top: top }); $zoomBox.css({ backgroundPosition: (-left) + "px " + (-top) + "px" });
And I set the background of the zoom element in CSS for the violin, but if you need to do this for multiple images, you can do it in JS just by copying the src attribute.
moopet
source share