lazy-loading
它能做什么
这个技能检查页面下方的内容是否只在需要时才加载。它面向希望首次加载更轻的开发者和设计师。
适用场景
- ✓长页面在访客滚动之前就加载了每张图片的时候。
- ✓嵌入的视频或地图在页面开头就开始加载的时候。
- ✓页面首次加载的数据量远超访客实际看到的内容的时候。
技能链接
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/lazy-loading/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 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.
热度
- GitHub 星标
- 75k
- 排名
- #2916
- 许可证
- MIT
- 更新时间
- 2026/10/31
评论
- …
同一仓库的更多技能
frontendchecklist
75k使用命令行工具,依据 380 多条关于无障碍、速度、SEO 和安全的规则,检查前端代码和线上页面。
frontend-checklist-global
75k依据全部 386 条 Front-End Checklist 规则审查前端项目,并为发现的每个问题给出具体修复方法。
404-page
75k检查你的页面缺失提示是否提供有用的链接,并返回真正的 404 状态,帮助迷路的访客找到方向。
about-page
75k审查你的网站是否有清晰的关于页面,说明由谁运营,以建立访客和搜索引擎的信任。