bbc / Imager.js

Responsive images while we wait for srcset to finish cooking
Apache License 2.0
3.84k stars 224 forks source link

Issues with resizing of Lazyloaded images #71

Closed anthonybruno closed 9 years ago

anthonybruno commented 10 years ago

While attempting to use the experimental lazyload option I believe that there is a bug regarding once an image has been loaded, it will no longer resize according to whatever information within the availableWidths array. eg If the image loads at 640, no matter what the size of the viewport, it will remain 640.

I've uploaded an example with the demo mostly untouched with some minor changes:

You can view the example here: http://anthonybruno.io/sandbox/imager

thom4parisot commented 10 years ago

Hello,

thanks for reporting the issue. @Integralist, how have you envisioned the lazyloading to work? What is the expected behaviour for already loaded pictures when the screen size changes and requires a new src URL?

Integralist commented 10 years ago

@oncletom Heya,

Yeah that's an interesting bug, good spot @anthonybruno :-)

I'd assume that the expected behaviour to be that the image source is changed when the screen dimensions change and the subsequent image should be loaded (only those within the viewport though - the others should only change when you scroll them into view).

That seems to make the most sense to me. What do you reckon?