Code Monkey home page Code Monkey logo

Comments (14)

aFarkas avatar aFarkas commented on May 18, 2024

@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:

  1. The image(s) in view are downloaded as early as possible
  2. 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:

  1. good performance: performance is the same like normal lazy loading techniques
  2. 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
  3. 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.

TrilipuT avatar TrilipuT commented on May 18, 2024

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.

aFarkas avatar aFarkas commented on May 18, 2024

@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.

TrilipuT avatar TrilipuT commented on May 18, 2024

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.

yoavweiss avatar yoavweiss commented on May 18, 2024

The bug won't be fixed for 40 unfortunately. I hope I can get it in 41 before it branches

from lazysizes.

aFarkas avatar aFarkas commented on May 18, 2024

@TrilipuT

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.

aFarkas avatar aFarkas commented on May 18, 2024

@yoavweiss
Thx.

from lazysizes.

TrilipuT avatar TrilipuT commented on May 18, 2024

@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.

aFarkas avatar aFarkas commented on May 18, 2024

@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.

aFarkas avatar aFarkas commented on May 18, 2024

@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.

salcode avatar salcode commented on May 18, 2024

@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.

aFarkas avatar aFarkas commented on May 18, 2024

@TrilipuT

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.

TrilipuT avatar TrilipuT commented on May 18, 2024

It's gone in your demo. At my project will check tomorrow morning and give you feedback.
Thanks for great work ;-)

from lazysizes.

yoavweiss avatar yoavweiss commented on May 18, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.