Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
IntersectionObserverはいいぞ
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Leko
September 15, 2017
Programming
3.2k
3
Share
IntersectionObserverはいいぞ
IntersectionObserverを使っていただきたいだけの話
Leko
September 15, 2017
More Decks by Leko
See All by Leko
コンセプトの海の泳ぎ方
leko
0
52
JSConf JPのwebsiteをGatsbyからNext.jsに移行した話 - Next.jsの多言語静的サイトと課題
leko
3
370
エンジニアと治療アプリ®
leko
0
1.3k
Node.jsにContributeして一ヶ月でCollaboratorになった
leko
5
7.6k
React NativeアプリでE2Eテストを回してみた
leko
8
3k
React Nativeで医療機器作ってます
leko
4
1.8k
趣味では使っているが 仕事には使ってないツール
leko
1
250
レガシーな開発現場にUTを入れてCIを導入した話
leko
0
6.4k
MySQLがゆるふわなのはどう考えてもSQLモードが悪い!
leko
1
360
Other Decks in Programming
See All in Programming
Back to the roots of date
jinroq
0
840
Symfony AI in Action - SymfonyLive Berlin 2026
chr_hertel
1
150
AIベース静的検査器の偽陽性率を抑える工夫3選
orgachem
PRO
4
460
Claude CodeでETLジョブ実行テストを自動化してみた
yoshikikasama
0
1.2k
Building on Bluesky's AT Protocol with Ruby
mackuba
0
120
決定論 vs 確率論:Gemini 3 FlashとTF-IDFを組み合わせた「法規判定エンジン」の構築
shukob
0
160
Agent Skills を社内で育てる仕組み作り
jackchuka
1
2k
Kubernetesを使わない環境にもCloud Nativeなデプロイを実現する / Enabling Cloud Native deployments without the complexity of Kubernetes
linyows
3
390
サーバーレスで作る、動画データ管理基盤
oyasumipants
0
120
AI時代になぜ書くのか
mutsumix
0
390
WebAssembly を読み込むベストプラクティス 2026年春版 / Best Practices for Loading WebAssembly (Spring 2026)
petamoriken
5
1.1k
書き換えて学ぶTemporal #fukts
pirosikick
2
370
Featured
See All Featured
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.3k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.1k
Documentation Writing (for coders)
carmenintech
77
5.3k
Building Applications with DynamoDB
mza
96
7k
Thoughts on Productivity
jonyablonski
76
5.1k
Faster Mobile Websites
deanohume
310
31k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.4k
ラッコキーワード サービス紹介資料
rakko
1
3.3M
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.5k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
30 Presentation Tips
portentint
PRO
1
290
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.3k
Transcript
LT: IntersectionObserverはいいぞ @L_e_k_o
しごと 「CureApp禁煙」という治療アプリの開発 しゅみ プログラミング、トレラン、射撃 きになる react-native-web、OpenAPI(v3)、Almin L_e_k_o Leko れこ
Copyright CureApp, Inc. All Rights Reserved.
Scroll event なるべく頑張りたくない
• 画像の遅延ロード • 無限スクロール • スクロールスパイ(例:Googleのブログ) • 一定のスクロール位置からposition: fixed •
Adのインプレッション計測 • 視差効果・パララックス Scroll eventよくある処理
• scrollイベントの負荷を減らす - Qiita • Webフロントエンドに従事するお前らはいい加減高頻度イベン トとレイアウトとスタイリングの付き合い方を考えろ - Qiita •
JavaScriptでの多発するイベントの間引き処理 | 技術コラム | つみきブログ Scroll eventよくあるTips
$(window).on(‘scroll’, throttle(e => …) ) IntersectionObserver
IntersectionObserver The Intersection Observer API provides a way to asynchronously
observe changes in the intersection of a target element with an ancestor element or with a top-level document's viewport. Intersection Observer API - Web APIs | MDN
Forced Synchronous Layout その時点での DOM の位置を取得するために Layout 計算を行う。 この計算は同期処理であり、つまりブロックが発生する。さらにそれを onscroll
など頻度 の高いイベントの中で行うのは、スムーズなスクロール表示のためのブラウザの最適化を 阻害してしまう。 - Intersection Observer を用いた要素出現検出の最適化 | blog.jxck.io
やや先読み遅延ロード https://codepen.io/L_e_k_o/details/JroVxy
56行でスター1600
threshold + intersectionRatio https://codepen.io/L_e_k_o/details/Ewazyb
消えたらfixed、見えたらstatic https://codepen.io/L_e_k_o/details/OxPYay/
polyfill:w3c/IntersectionObserver
• 見えてる/見えない = entry.isIntersecting • どれくらい先読みするか = options.rootMargin • どれくらい見えてるか
= entry.intersectionRatio • 見えてる間のイベント発生頻度 = options.threshold 正確ではないまとめ
IntersectionObserverはいいぞ More details: Intersection Observer API - Web APIs |
MDN IntersectionObserver/explainer.md at master · w3c/IntersectionObserver Intersection Observer を用いた要素出現検出の最適化 | blog.jxck.io openfresh/viewport-observer (React) 96 line heavyy/vue-intersect (Vue)