Aller au contenu
Skillpedia
Sites et interfaces (frontend)75k · #2958

offscreen-lazy

Ce qu’il fait

Ce skill vérifie les balises image d'une page et ajoute le chargement différé aux images hors écran, tout en gardant l'image principale du haut de page en chargement immédiat. Il s'adresse aux créateurs de sites qui veulent des premiers chargements plus rapides.

Quand l’utiliser

  • ✓Quand vous demandez à l'agent d'accélérer une page qui charge de nombreuses images à la fois.
  • ✓Quand une longue page télécharge beaucoup de photos que les visiteurs ne verront peut-être jamais en faisant défiler.
  • ✓Quand vous examinez le balisage des images et voulez vous assurer que l'image principale n'est pas chargée en différé par erreur.

Lien du skill

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/offscreen-lazy/SKILL.md

Copiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.

Comment l’utiliser

Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.

Message prêt à coller

Utilise ce skill pour m’aider : https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/offscreen-lazy/SKILL.md Lis le fichier SKILL.md de ce lien et suis ses instructions pour ma tâche.
Envie que votre IA trouve seule des skills comme celui-ci ?Installez le MCP gratuit de Skillpedia : une ligne, et elle cherche parmi 15 000+ skills avant chaque tâche.Installer en 1 minute →

Exemple de demande à votre IA

“Ma longue page produit charge trop d'images à la fois. Pouvez-vous ajouter le chargement différé à celles qui sont sous la ligne de flottaison ?”

5 nouveaux skills par semaine. 1 minute de lecture.

Comment ça marche

L'agent examine chaque balise image et ajoute l'attribut de chargement différé natif à celles situées sous le premier écran. Il garde l'image principale en chargement immédiat et propose les attributs width et height pour éviter les décalages de mise en page.

Contenu technique (SKILL.md original)

Texte original de l’auteur, en anglais, directement depuis GitHub.

Lazy load offscreen images

Lazy loading eliminates unnecessary image downloads on initial page load. A page with 20 images below the fold may transfer several megabytes of data that users who don't scroll will never see. Deferring these downloads reduces Time to Interactive, improves LCP for above-fold content, and saves bandwidth—particularly impactful for users on metered mobile connections.

Quick Reference

  • Add loading="lazy" to all <img> elements below the fold
  • Never lazy-load the LCP image (hero, first product image)—use fetchpriority="high" instead
  • Always pair loading="lazy" with width and height attributes to prevent CLS
  • Native loading="lazy" has universal support in all modern browsers—no JavaScript polyfill needed
  • If fold position is unclear from the snippet, do not invent a lazy-loading defect

Check

Scan all <img> elements in this codebase. Identify: 1) Any <img> elements below the fold (not in the first viewport) that are missing loading="lazy". 2) Any <img> elements marked loading="lazy" that appear to be above the fold (hero images, first product images, logos in headers). 3) Any <img> with loading="eager" below the fold. Report the above-fold images that should NOT have lazy loading separately from below-fold images that should have it. If fold position cannot be inferred from the snippet, do not report missing lazy loading as a defect.

Fix

For images that should use lazy loading: 1) Add loading="lazy" to all <img> elements that appear below the fold. 2) Remove loading="lazy" from any hero, logo, or first-visible image—these should load immediately. 3) Ensure all lazy-loaded images have explicit width and height attributes to prevent CLS. 4) For the LCP image specifically, add fetchpriority="high" and remove loading="lazy". Show the corrected HTML for each modified image.

Explain

Explain how native browser lazy loading works. The loading="lazy" attribute tells the browser to defer image download until the image is within a browser-defined distance from the viewport (typically 1250px on a slow connection). This reduces the data transferred on initial load, lowers Time to Interactive, and saves bandwidth for users who never scroll to those images. Browser support is universal in modern browsers. The critical caveat: never lazy-load the LCP image—it must load as fast as possible.

Code Review

Review image assets, markup, and delivery configuration related to Lazy load offscreen images. Flag exact files or components where format choice, sizing, or loading behavior violates the rule, and describe how to confirm the fix in DevTools.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/images/offscreen-lazy

Questions fréquentes

Pourquoi l'image principale ne doit-elle pas être en chargement différé ?

Elle est généralement le plus grand élément visible, et la charger tard peut ralentir le contenu principal. Le skill suggère plutôt fetchpriority réglé sur high.

Ai-je besoin d'une bibliothèque JavaScript pour cela ?

Non. Le skill indique que le chargement différé natif est pris en charge par tous les navigateurs modernes et ne nécessite aucun polyfill.

Que faire s'il n'est pas clair qu'une image est hors écran ?

Le skill indique de ne signaler un chargement différé manquant que si l'image est raisonnablement clairement hors écran ou non critique.

Détails

Description originale de l’auteur

Use when reviewing image assets, markup, and CDN or build transforms related to Lazy load offscreen images. Check encoded size, rendered size, loading strategy, and above-the-fold impact together. Missing `loading='lazy'` is only a valid finding when you can reasonably tell the image is offscreen or non-critical.

repo: thedaviddias/Front-End-Checklist

Popularité

Étoiles GitHub
75k
Position au classement
#2958
Licence
MIT
Mis à jour
31/10/2026

Ce skill vous est-il utile ?

0

Connectez-vous pour voter.

Commentaires

  • …

Autres skills de ce dépôt

Skills similaires