fancyapps / fancybox

jQuery lightbox script for displaying images, videos and more. Touch enabled, responsive and fully customizable.
http://fancyapps.com/
7.28k stars 1.78k forks source link

React to viewport changes to select correct image from srcset #1526

Open MarioHoberg opened 7 years ago

MarioHoberg commented 7 years ago

When the viewport changes (the browser windows is resized), the browser loads the images appropriate for the new viewport.

Fancybox still displays the old images, also for already preloaded files.

Fancybox should replace the displayed and preloaded images with those for the new viewport.

fancyapps commented 7 years ago

Hi,

fancyBox creates html markup according to specs, but the rest is up to the browser. And what browsers do, sometimes is a mystery.

andrewd72 commented 6 years ago

This is the only problem I'm trying to fix, it is an excellent lightbox/gallery and I've tried a LOT of others this week.
Is there a way to check if you toggle to ENABLE fullscreen (going back doesn't matter) and update the current image srcset (and the preloads)? I don't think it is a mystery, the browser already has the srcset choice made so it isn't going to change it unless it is explicitly told to, it behaves as expected just not as we ideally want. In terms of bandwidth saving the browser is doing a better job but a fix for gallery perfection would be lovely.

Its DOES choose the correct image if you cycle through the images and see the first images again.

Also - can't seem to turn off preload with either image : { preload: false } or preload: false

So it always shows two at the wrong size after change to fullscreen before getting it right. Thanks.