Langsung ke konten
Skillpedia
Website & UI (frontend)75k · #2958

offscreen-lazy

Fungsinya

Skill ini memeriksa tag gambar pada halaman dan menambahkan lazy loading pada gambar yang berada di luar layar, sambil membiarkan gambar hero di bagian atas tetap dimuat segera. Skill ini ditujukan untuk pembuat situs yang menginginkan pemuatan awal yang lebih cepat.

Kapan dipakai

  • ✓Saat Anda meminta agent mempercepat halaman yang memuat banyak gambar sekaligus.
  • ✓Saat halaman panjang mengunduh banyak foto yang mungkin tidak pernah digulir pengunjung.
  • ✓Saat Anda meninjau markup gambar dan ingin memastikan gambar hero tidak di-lazy load secara tidak sengaja.

Link skill

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

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/offscreen-lazy/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit →

Contoh permintaan ke AI

“Halaman produk panjang saya memuat terlalu banyak gambar sekaligus. Bisakah Anda menambahkan lazy loading untuk gambar yang berada di bawah lipatan?”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Agent meninjau setiap tag gambar dan menambahkan atribut lazy loading bawaan pada gambar yang berada di bawah layar pertama. Agent mempertahankan gambar hero tetap dimuat segera dan menyarankan atribut lebar dan tinggi untuk menghindari pergeseran tata letak.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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

Pertanyaan umum

Mengapa gambar hero tidak boleh di-lazy load?

Gambar itu biasanya elemen terbesar yang terlihat, sehingga memuatnya terlambat bisa memperlambat konten utama. Skill ini menyarankan fetchpriority high untuknya.

Apakah saya memerlukan pustaka JavaScript untuk ini?

Tidak. Skill ini menyebut lazy loading bawaan didukung di semua peramban modern dan tidak memerlukan polyfill.

Bagaimana jika tidak jelas apakah gambar berada di luar layar?

Skill ini menyebut jangan melaporkan lazy loading yang hilang kecuali gambar jelas berada di luar layar atau tidak kritis.

Detail

Deskripsi asli dari pembuat

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

Popularitas

Bintang GitHub
75k
Peringkat
#2958
Lisensi
MIT
Diperbarui
31/10/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa