question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add img native lazy loading + fallback

See original GitHub issue

Is your feature request related to a problem? Please describe. Need of optimizing critical path of websites deferring load of multimedia below the fold.

Describe the solution you’d like Implement https://web.dev/native-lazy-loading best practices for lazy loading, now that native lazy loading is a real thing on Chrome 76 at least.

This article also presents a sort of polyfill (lazyload) in vanilla JS which seems to be well known and with an extensive documentation.

Usage of loading="lazy" could be detected at build time (via a webpack loader?) and, if found:

  • add global feature detection and fallback library;
  • for every images/videos/iframe where lazy loading is requested, trigger rewriting of src, srcset, etc into corresponding data-src, data-srcset, etc.

The tricky part could be to manage dynamically loaded pages, because the fallback library checks images at load or calling its update moment at the right time.

This could directly become the default because it would be opt-in by design (no loading="lazy", no code to manage it). Chrome will probably switch its loading="auto" default to be lazy instead of eager in a while, hopefully other browsers will follow it providing native lazy loading for everyone 😃

Maybe also adding a lazy prop on QImg could be a good idea, which would just resolve in adding loading="lazy" if the previously described webpack loaded takes care of everything else.

Describe alternatives you’ve considered Same stuff, but non directly integrated into Quasar, maybe with an app-extension.

Additional context

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
rstoenescucommented, Nov 8, 2019
0reactions
pintafcommented, Aug 18, 2020

+1, would love to see this integrated by default.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Native Lazy Image Loading With JavaScript Fallback
Lazy image loading is a technique to avoid unnecessary downloads by delaying below-the-fold images until each image appears on screen. Similar to other ......
Read more >
Browser-level image lazy loading for the web - web.dev
This post covers the loading attribute and how it can be used to control the loading of images.
Read more >
Native Lazy Loading + A Fallback Solution ..in 60 seconds
(Codepen code below) Chrome just released native lazy loading, ... If it does support it, we iterate through our images and add the...
Read more >
Lazy Loading Images – The Complete Guide - ImageKit.io
The general concept of lazy loading images in <img> tag​​ Lazy loading images can be broken down into two steps: Step one is...
Read more >
Native lazy loading and js-based fallback with vanilla-lazyload ...
Note that you can lazily load responsive images using both the img tag and the picture tag. Read more about lazy loading responsive...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found