Check out this nice image-zooming library by Desmond Ding. It’s fairly little, has no dependencies, and has all the modern stuff to make it easy to integrate into modern sites (you know, available on npm, and modulized). I tossed a demo up on CodePen for playing convenience:
When I said “fairly little” there, the minified version is still 7K. Check out Dave Rupert’s take where it’s all done with some transitions and viewport units. That’s just a few bytes of code!
Ahhhhh the power of changing classes.