本文へスキップ
Skillpedia
WebサイトとUI(フロントエンド)75k · #2889

import-on-visibility

できること

このスキルは、長いページやフィードで、見えるようになる前に読み込まれる重いセクションを確認します。コンテンツの多いページを作る開発者向けです。

使う場面

  • ✓長いページで、ほとんどの訪問者がスクロールしないグラフやレビューを読み込んでいるとき。
  • ✓フィードやダッシュボードが、遠くにあるパネルのコードを送っているとき。
  • ✓重いセクションが現れて、スクロールがかくつくとき。

スキルのリンク

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/import-on-visibility/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/import-on-visibility/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“レビューのセクションを、訪問者がスクロールして近づいたときだけ読み込むようにしてもらえますか。”

毎週5つの新しいスキル。1分で読めます。

仕組み

エージェントは、先に読み込まれてしまう画面外のコンポーネントを見つけ、Intersection Observer を使って、表示領域に近づいたら読み込むことを提案します。レイアウトがずれないようにプレースホルダーも提案します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Load non-critical code when content approaches the viewport

Many pages ship JavaScript for offscreen sections that a user may never reach. Import-on-visibility keeps the initial route lighter while still loading content early enough to feel ready when users scroll to it.

Quick Reference

  • Use Intersection Observer to start loading code before an offscreen section becomes visible
  • Reserve space with placeholders or skeletons so deferred sections do not cause layout shift
  • Tune rootMargin so heavy content loads early enough without competing with above-the-fold work
  • Use this for charts, reviews, related products, embeds, and offscreen dashboards

Check

Identify components, widgets, or modules that load on first render even though they only appear after the user scrolls. Flag which ones can switch to visibility-based loading.

Fix

Use Intersection Observer or an equivalent framework primitive to load the offscreen component or dependency when it approaches the viewport, while preserving layout stability and a clear placeholder.

Explain

Explain import-on-visibility, how it differs from import-on-interaction, and how viewport-based loading helps large pages stay fast.

Code Review

Inspect scroll-triggered sections, embeds, charts, recommendation modules, and long landing pages. Flag code that is bundled eagerly even though the corresponding UI stays offscreen until later, and verify the deferred version still loads before the user reaches it.


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

Rule page: https://frontendchecklist.io/rules/performance/import-on-visibility

よくある質問

Intersection Observer とは何ですか?

要素が表示領域に近づいたり、入ったりしたときにそれを知らせる、ブラウザの機能です。

クリックで読み込む方法とはどう違いますか?

これは、セクションが画面に近づいたときにコードを読み込みます。クリックで読み込む方法は、訪問者の操作を待ちます。

なぜプレースホルダーを使うのですか?

遅延されたセクションがレイアウトのずれを起こさないように、レイアウトを安定させるためだとこのスキルは説明しています。

詳細

作者による元の説明

Use when reviewing long pages, dashboards, or content feeds with expensive offscreen modules. Balance early enough loading for smooth scrolling against keeping the initial route light.

repo: thedaviddias/Front-End-Checklist

人気

GitHubのスター
75k
ランキング
#2889
ライセンス
MIT
更新日
2026/10/31

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル