-
Notifications
You must be signed in to change notification settings - Fork 98
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
Zoom into original image when using srcset
in Fancybox
#380
Comments
Hi, Sorry, but could you clarify your question? It would be great if you could describe step by step what is happening on each action, and what would you like to see instead. |
Sure @fancyapps. What is happeningSupposing the following code: <a data-fancybox="gallery"
href="/width-1600.jpg"
data-srcset="/width-576.jpg 576w, /width-768.jpg 768w, /width-1200.jpg 1200w, /width-1600.jpg 1600w"
data-sizes="(max-width: 576px) 576px, (max-width: 768px) 768px, (max-width: 1200px) 1200px, 1600px">
<img src="/thumbnail.jpg">
</a> Steps:
If the tag also contains <a data-fancybox="gallery"
href="/width-1600.jpg"
data-srcset="/width-576.jpg 576w, /width-768.jpg 768w, /width-1200.jpg 1200w, /width-1600.jpg 1600w"
data-sizes="(max-width: 576px) 576px, (max-width: 768px) 768px, (max-width: 1200px) 1200px, 1600px"
data-width="1600" data-height="900">
<img src="/thumbnail.jpg">
</a> Then step 5 becomes:
What I would like to see instead
|
Well, the idea of Fancybox (or any similar lightbox-type script) is that you point to the full size image. When the image is loaded, it is displayed resized, if needed. User can then click, use mouse wheel, or use a pinch gesture to see the full size. I will consider your feature request to change the image source depending on the scale |
Sorry, I'm not sure what you mean – are you saying that you recommend using Fancybox with full-size images only, and that using To me, using
When the user does want to zoom in on a particular image however, the smaller rendition loaded from the Example bandwidth calculationWith the 800px viewport mentioned above, let's assume 800px renditions are 0.5MB each, and original images are 2MB each. The users goes through a gallery of 10 images, ands zooms into one of them. Total bandwidth with originals: 10 * 2MB = 20MB Total bandwidth with Bandwidth savings: 65%. Thanks for considering this. |
The idea is that you use But, of course, it depends on the use case. Maybe you want to present your highly detailed photos. But you would also want to save bandwidth. In such case it would be best to load only part of the image when user zooms, but then you would have to create tiles and in the end, Fancybox would work similarly to Leaflet.js and others. Actually, at some point I explored possibilities to make Fancybox work with tile providers, but, since it adds quite a lot of complexity, decided to postpone it. Also, I am not sure how many users would find it useful. |
I agree that tiling feels overkill. However, maybe just using LightGallery also seems to support this already, so there is probably at least some user demand for this. |
Are you really 100% sure PhotoSwipe works exactly as you imagined? Maybe I am missing something, but it actually works the same as Fancybox, except it does zoom animation on the thumbnail image and then switches to the full image size. Fancybox v3 works the same, but some users complained that switching images looks like a bug, not a feature, therefore in v4 it was dropped (interestingly, no one has asked to bring that back yet). |
I do believe it does. See https://photoswipe.com/getting-started/#responsive-images-with-srcset and try the demo in that section in a smaller window responsive preview. Attaching a screen recording below to illustrate. photoswipe.mov |
When using
data-srcset
, zooming zooms into the currently selected source of thesrcset
. If the source sizes are judiciously selected, the image is already appropriately sized for the viewport, so very little zooming actually happens. Or, ifdata-width
anddata-height
were specified, the image is indeed zoomed to those dimensions, but the source is not switched, which can cause upscaling.Is there a way to always use the original (
href
/data-src
) image for zooming instead? I understand this can cause a delay as the image may need to be loaded when the zoom action is triggered (and prefetching the original would defeat the point of usingsrcset
).Observed with latest Fancybox on MacOS Chrome 107.
The text was updated successfully, but these errors were encountered: