Comments (14)
@salcode
Thx, but this is by design since version 0.6.0. I have changed the option preloadAfterLoad
to true
.
If you analyze your network panel. You will see two things:
- The image(s) in view are downloaded as early as possible
- The images, which are not in view, are only loaded after onload and in queue (between one and two image at the same time)
From my testing this has the following advantages:
- good performance: performance is the same like normal lazy loading techniques
- better UX than normal lazyloading: images are pre-downloaded in the background without blocking other downloads, so that the user doesn't have to wait for images to download as soon as the user scrolls them into view
- better search engine support than normal lazyloading: google does evaluate JS since at least october 2014. But due to the fact, that the google bot does not perform any scrolling, normal lazyloading will hide images from google. With this technique the chance, that lazyloaded images are indexed is quite high even if you don't use the LQIP markup pattern.
The only disadvantage is, that normal lazyloading might reduce transferred data, in case a user leaves the page before he has scrolled to all areas of the page.
I might re-change this option, if this is too irritating or if developer think that the disadvantage outweighs the advantages.
Of course you can change this option at any time:
window.lazySizesConfig = {
preloadAfterLoad: false
};
What do you think, about this option shift?
from lazysizes.
I noticed not loading full images at all on demo page... But it could be my chrome beta bug :)
About preload option - i use true on desctop and false on mobile where traffic usage could be important.
from lazysizes.
@TrilipuT
I think this is the possibly best thing you can do. Although differentiating between metered and non-metered bandwidth is impossible. How does your check look like?
About Chrome: Yeah, I think you run into this bug:
https://code.google.com/p/chromium/issues/detail?id=431862
Hope I don't need to add a workaround for this:
http://jsfiddle.net/zyjLLL81/6/
@yoavweiss
Do you know wether this bug will be fixed in Chrome (40) stable.
from lazysizes.
In future we can check connection with navigator.connection, maybe :)
I check if user is mobile with this one http://detectmobilebrowsers.com/
Works quite well.
from lazysizes.
The bug won't be fixed for 40 unfortunately. I hope I can get it in 41 before it branches
from lazysizes.
Can you confirm that you can't see this bug on the master version anymore?
https://rawgit.com/aFarkas/lazysizes/master/index.html
from lazysizes.
@yoavweiss
Thx.
from lazysizes.
@aFarkas
Still have this.
The problem is in last 2 big pictures examples "responsive image with srcset and automatic sizes attribute" and "Widgets/Javascript/Script". Other loads good.
I noticed that i have
sizes="1130px"
but biggest scrset size is 1024w. When i sizes to 1024px - it loads right image.
Also i got this problem on my project, so i need to duplicate biggest image with 2x (in this case it will be 2048w). Maybe this is chrome logic of native support of scrset? And when we use "auto" is sizes maybe it should check scrset and give value one of them?
https://cloud.githubusercontent.com/assets/1821978/5563233/f276401c-8e6b-11e4-90b0-b490883580e8.png
https://cloud.githubusercontent.com/assets/1821978/5563234/f2769684-8e6b-11e4-9b82-4620d0c9e24d.png
Tested on OS X 10.10.1 (14B25)
Chrome 40.0.2214.45 beta (64-bit)
from lazysizes.
@TrilipuT
Yeah, this would fix the bug, but would mean, that I have to implement a srcset parser + analyze the candidates (= a lot of code). I think, I got a working hack now.
from lazysizes.
@salcode
I have re-reverted the preloadAfterLoad option to false now (only in master). Because I think many people find this irritating. I will improve the readme so that people know that this option is often a good thing.
from lazysizes.
@aFarkas
I think this is the perfect way to handle it. I think the term lazyloading has specific set of expectations with it, which includes loading only when in view. I can see the value of the preloadAfterLoad and I think the README is a great way to point out the value of the setting that option.
Thanks.
I have re-reverted the preloadAfterLoad option to false now (only in master). Because I think many
people find this irritating. I will improve the readme so that people know that this option is often a good thing.
from lazysizes.
While I'm pretty sure, that your bug should be gone now. I would like to have a confirmation from you (not only my demo page, but also inside your project).
from lazysizes.
It's gone in your demo. At my project will check tomorrow morning and give you feedback.
Thanks for great work ;-)
from lazysizes.
@aFarkas - I've closed https://code.google.com/p/chromium/issues/detail?id=431862 since the behavior is as intended. If you'd change sizes
in your example, or add resources such that the required resource would be wider than sizes (so its density would be larger than 1), I think the example would work the way you want it to.
Let me know if you have any questions.
from lazysizes.
Related Issues (20)
- Lazy loading of SVG foreignObject after zoom animation.
- A bit confused as to how to get responsive images working? HOT 1
- Chrome Issue Logged - Audit Usage of navigator.userAgent
- Big gallery IOS performance issue
- Pausing Intersection effect when scrolling
- Images not showing when lazyload class is removed HOT 1
- How do I test it?
- safari 16 lqip stopped working, only low quality image is showing HOT 2
- Problem with Ajaxed Content and Unveilhooks
- Interferences with Modernizr
- supportScroll for headless navigator
- Demo site images load error 403 404 HOT 1
- lazySizes.loader.unveil(imgElem) Method does not show all images in page HOT 1
- lazySizes Object undefined in latest Safari HOT 1
- i have image injected inside outer world app. And this world app has vtex-lazyload based on lazysizes. And its configured as
- vtex-lazyload and lazysizes conflict
- PreloadAfterLoad should use "prefetch"
- Blur up image inline styles are lost
- Error: Element img is missing required attribute src. HOT 2
- parent-fit in fontFamily is ignored
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lazysizes.