jackmoore / wheelzoom

A small script for zooming IMG elements with the mousewheel/trackpad.
http://www.jacklmoore.com/wheelzoom
MIT License
342 stars 95 forks source link

Crop to parent element, rather than original image size? #3

Closed fisharebest closed 10 years ago

fisharebest commented 10 years ago

I'm using wheelzoom with your colorbox library.

When viewing a portrait image on a landscape screen (or vice versa), there is whitespace to the side of the image. For the unzoomed image, this is necessary to preserve the aspect ratio.

unzoomed

But when zooming in, it would be much more natural if the image could expand to fill the parent element, rather than being constrained to the original image size. Here, the whitespace is wasted - there is no reason why the image shouldn't expand horizontally.

zoomed

Is it possible to modify the library so that the image is cropped to a parent, rather than its original size?

jackmoore commented 10 years ago

Sorry, that is outside the scope of what I want the plugin to do.