francoischalifour / medium-zoom

🔎🖼 A JavaScript library for zooming images like Medium
https://medium-zoom.francoischalifour.com
MIT License
3.58k stars 160 forks source link

Manipulation image size #198

Closed anluh closed 1 year ago

anluh commented 1 year ago

The problem

There are a bunch of cases when would be nice to have an opportunity to change image width & height & scale. For now if you change sizes by CSS - the position is overridden by JS element styles, which gives a lot of display issues.

Solution

It would be nice to have a dynamic way to rule these CSS options.

francoischalifour commented 1 year ago

You can specify the exact dimension of the zoom container with the container option. You can read more on Rendering with coordinates.

Let me know how this works out for you.

anluh commented 1 year ago

Yeah, but it would be nice to have an opportunity for ex. to scale image some more on a custom event. But because it sets position programmatically I can't do it.

francoischalifour commented 1 year ago

You should be able to update the container option when the custom event occurs with the update() option.

francoischalifour commented 1 year ago

I'm closing this for now @anluh—but feel free to reopen if you can't achieve what you want to do with the proposed solution.