Run this code on your page and every link pointing to an image will zoom out of the page.
The plug-in reacts to all links pointing to images in the element that you run it on. So you might do
ImageZoom.init(document.getElementById('gallery')) but you could also run it on the entire page with
ImageZoom.init(document.body). If you're using jQuery you can do
This is an old jQuery plug-in that I've now converted to pure JS. Because of this, browser support may not be what it used to be, but it's less than 4kb unpacked and is only one file now.
The plug-in obviously works best if the two images are identical in every way except size.
This is the first version, so there may be bugs, and I'll probably add support for older browsers in the future.
Download on GitHub