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

when using lazyLoad with srcset, do not download the image twice #2738

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

wickning1
Copy link

This is a fix for pull request #2681 by fozzleberry, titled "Lazy loading with srcset and sizes attributes"

The problem I was seeing was that the in-memory image used for triggering onload was only being loaded with src, not srcset and sizes, so it was making a different decision about which image size to use than the image in the DOM. Adding srcset and sizes to the in-memory image helps the browser make the same decision both times, and thus not download two different sizes of the same image.

@clementduncan
Copy link

Perfect fix to stop it loading the image from src and the relevant srcset image.
Many thanks!

@croxton
Copy link

croxton commented May 31, 2017

Works great thank you.

@aphillips8
Copy link

Thanks for this fix. Hopefully it gets merged soon!

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

Successfully merging this pull request may close these issues.

4 participants