Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable zooming images #43

Open
philgyford opened this issue Oct 23, 2023 · 1 comment
Open

Enable zooming images #43

philgyford opened this issue Oct 23, 2023 · 1 comment
Labels

Comments

@philgyford
Copy link
Owner

Would be good to be able to click/tap an image and have it zoom to be as wide/tall as the viewport allows. Maybe disable on small screens? Or allow zooming in further.

https://github.com/kingdido999/zooming is nice because it does one thing. Doesn't create a "Lightbox" in which you can scroll through several images.

But it doesn't work for us because of the overflow:hidden on #window. The image zooms, but only within the confines of the central article "window". I tried disabling/enabling the overflow when an image opens/closes using onBeforeOpen() and onClose() callbacks… which seemed to work, but closing an image resulted in it bouncing open again, except this time with the overflow in place.

Maybe we can look at how that plugin does things and create our own simplified version that works for our one use case.

I think we can target all img.gu-image images to get the ones in the body of articles. Could do the same for the "thumbnail" images, but note that they're only 500px instead of 1000px. Looks like you can change the 500.jpg filename to 1000.jpg for them and get the big version though.

@philgyford
Copy link
Owner Author

Also tried https://github.com/spinningarrow/zoom-vanilla.js which is promising, but for some reason the zoomed image is given strange proportions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant