-
-
Notifications
You must be signed in to change notification settings - Fork 676
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
Using transparent 1x1 pixel src placeholder #212
Comments
Hi @gerdneuman, The reason I’m not advising to use a transparent pixel as a placeholder in the readme is that, if you do that, the browser only shows the lazily loaded image to the users when they are COMPLETELY loaded; and if you care about performance, including perceived performance - which is measured by google through the SpeedIndex - you want the images to be shown as soon as they start loading, especially if they are in the Progressive JPEG format, but also in their baseline version. Is that clearer now? |
@verlok thanks for answereing :) I totally agree with you that for perceived performance, which is important, images should be shown asap.
How is this is the case? I thought that LazyLoad would replace the What you say sounds like: browser fetches image and only then (after fetch is completed) the So I am confused :) Other than that, might it be a solution using something like to show the real image immediatly as soon as loading begins:
|
Hey @verlok still confused on how it works, but maybe you could then add a recommendation to https://github.com/verlok/lazyload#show-the-images-while-they-load that transparent placeholder GIFs should not be used. Well, that LazyLoad does not recommend this because of xyz. Maybe I am looking at it from the wrong side because rocket-lazyload (based on your LazyLoad) recommends using a placeholder GIF. And so does the other lazyloading js library. If there was a guidline for this by LazyLoad then at least rocket-lazyload (which I use in the end) could be updated. Right now I feel like optimizing something (using placeholder gif) which might (still not understanding) have the inverse effect :) |
Hey,
Is that any clearer now? |
Hi again @gerdneuman, about:
this is a social coding community, why don't you fork my repo, do the change you would like to see in the README.md file, then open a pull request to integrate the change in this repo? |
As a proof of what I stated in my previous comment, I've created this code on CodePen: LazyLoad, progressive JPG and placeholder images. You can view the difference setting a slower connection speed (I used "fast 3G") and disabling the cache. I also recorded a video of the result, which I published on Youtube as LazyLoad and placeholder gif loading time - a comparison. |
Thanks so much on clarifying this. Today I learnt something :) FWIW, as a Firefox user I tested using the Firefox network throttle feature and for slower connection speeds like "Regular 2G" the perceived performance is way better without a placeholder. :) |
I did not find any docs on adding a transparent 1x1 pixel placeholder which I found strange. Wouldn't make sense to have the
src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="
at the beginning?Like proposed here: https://github.com/aFarkas/lazysizes#tip-specifying-image-dimensions-minimizing-reflows-and-avoiding-page-jumps
Also lazy-load-rocket which is based on lazyload js plugin does this (though they still use a white instead of a transparent pixel):
wp-media/rocket-lazy-load#56
I think the README should mention this or give best practices. A transparent GIF pixel placeholder would play nicely with Progressive JPEG in my opinion and I think something like https://github.com/verlok/lazyload#show-the-images-while-they-load would not be needed. Because first transparent GIF would be shown which is then replaced by progressive jpeg or am I wrong?
The text was updated successfully, but these errors were encountered: