跳到正文
Skillpedia
网站与界面(前端)75k · #2916

lazy-loading

它能做什么

这个技能检查页面下方的内容是否只在需要时才加载。它面向希望首次加载更轻的开发者和设计师。

适用场景

  • ✓长页面在访客滚动之前就加载了每张图片的时候。
  • ✓嵌入的视频或地图在页面开头就开始加载的时候。
  • ✓页面首次加载的数据量远超访客实际看到的内容的时候。

技能链接

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

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/lazy-loading/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请帮我为页面下方的图片设置懒加载吗?”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会找出位于首屏以下的内容,并建议使用原生懒加载或 Intersection Observer。它会避免对页面顶部最重要的图片设置懒加载。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Implement lazy loading for offscreen content

Lazy loading defers non-critical resources until needed—this reduces initial page weight, speeds up first paint, and saves bandwidth for content users may never scroll to.

Quick Reference

  • Use loading='lazy' for images below the fold
  • Never lazy load LCP/above-fold images—they need priority
  • Lazy load iframes, videos, and heavy components
  • Use Intersection Observer for custom lazy loading
  • If fold position is unclear from the snippet, do not invent a lazy-loading defect

Check

Verify that images and other heavy resources below the fold are lazy loaded. Only report this when the code or route context makes offscreen placement clear.

Fix

Implement lazy loading for images, videos, and iframes using native loading='lazy' or JavaScript solutions.

Explain

Explain how lazy loading defers resource loading until needed, improving initial page load performance.

Code Review

Review the routes, assets, and loading behavior that affect Implement lazy loading for offscreen content. Flag exact files, requests, or rendering steps that add unnecessary network, CPU, or layout cost, and describe the measurement method used to confirm the issue.


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

Rule page: https://frontendchecklist.io/rules/performance/lazy-loading

常见问题

什么是原生懒加载?

它是浏览器内置的设置,会在图片或框架接近屏幕时才开始加载。

什么内容绝对不能懒加载?

这个技能说,页面顶部最大的内容图片绝对不能懒加载。

如果内容的位置不清楚怎么办?

这个技能说,除非代码明确表明位置,否则不要报告问题。

详情

作者的原始描述

Use when auditing slow page loads, heavy assets, or rendering delays related to Implement lazy loading for offscreen content. Verify the actual bottleneck in DevTools, Lighthouse, or field data before recommending changes. Absence of `loading='lazy'` is not enough by itself when fold position is unknown.

repo: thedaviddias/Front-End-Checklist

热度

GitHub 星标
75k
排名
#2916
许可证
MIT
更新时间
2026/10/31

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能