Comments (4)
We could support two attributes data-zoom-width
and data-zoom-height
that indicates Medium Zoom which dimensions should the zoomed image take.
from medium-zoom.
Thanks for opening this issue.
The challenge with scaling a low-quality image before having the HD image loaded is that there's no way to know where the image should be positioned. This is because we don't know in advance the size of the HD image. The only information that we can guess is the ratio, which still might change from the low-quality image.
There are already strategies put in place to start the animation as soon as we can detect the HD image size, without it being fully loaded yet. To my knowledge, this is the best solution without making false assumptions.
The possible alternative that I usually recommend is to preload the HD images when the low-quality image enters in the viewport. You can check my implementation shared earlier.
If I'm proved to be wrong, feel free to send a PR!
Let me know if that works for you.
from medium-zoom.
I see. I haven't thought about the lack of info. My HD images are always the same ratio as the default ones and fill the whole available area so I don't face the issues you mentioned.
I'm using the preload alternative currently, which is not the optimal solution but it does the job.
Thanks u for the quick reply :)
from medium-zoom.
@francoischalifour
Hi, what if I've already received the natural width & height of the HD image from my server, is there a way to prevent the zoom-in animation from "freezing"?
I'd like to load the HD image after the zoom-in animation finishes, instead of doing nothing but watching the whole screen freezes.
(In my case, preloading the HD image doesn't fit, because its size is too large. I don't want to waste my bandwidth if my client has not clicked on the source image)
from medium-zoom.
Related Issues (20)
- Images get loaded/reloaded too often HOT 3
- Pressing image zooms it out
- Support for prefers-reduced-motion HOT 1
- Zoomed image not closing in browsers not supporting srcset (IE11 and Edge 13-15)
- Auto closed on iOS safari browser HOT 1
- Zoomed image appears behind the sidebar HOT 2
- Not work on <img> element in markdown. HOT 4
- Vitepress support HOT 2
- data-zoom-src not working with loading attribute HOT 5
- Pinching zoom option
- Nuxt with medium-zoom, weridly on the directly load in.
- SVG images sometimes don't have a '.svg' extension
- Gallery on full viewport mode (feature request) HOT 2
- Customize overlay HOT 1
- Working Nuxt3 example - add to README.md or separate page? HOT 1
- Cannot close overlay before `opened` event has fired. HOT 3
- Manipulation image size HOT 4
- Zoomed image size exceed intrinsic image size HOT 3
- use picture bed can't show image in website HOT 1
- The image is not centered and scale in iframe
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from medium-zoom.