Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Lazy loading images With the intersection observer
Search
Juan
November 06, 2018
Programming
92
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Lazy loading images With the intersection observer
Juan
November 06, 2018
Transcript
22 slides
LAZY LOADING IMAGES WITH THE INTERSECTION OBSERVER SLC Front end
DEV
I ❤ • OPEN SOURCE @AMPHTML • INSTRUCTOR @UDEMY •
ENGINEERING @IMPARTNERPRM • !" @juanlizarazog HI! I AM JUAN LIZARAZO
@juanlizarazog AMPPROJECT.ORG BUILDING THE FUTURE WEB, TOGETHER. THE AMP PROJECT
@juanlizarazog What’s lazy loading?
@juanlizarazog Bounce rate
@juanlizarazog
PERFORMANCE MATTERS! @juanlizarazog
LAZY LOADING RESOURCES MATTER! @juanlizarazog
@juanlizarazog Our Goal Complete first meaningful render under 1 second
Image Lazy loading @juanlizarazog
@juanlizarazog No. 1 Element.getClientBoundingRect()
@juanlizarazog const domRect = element.getBoundingClientRect(); { "x": 418.4375, "y": 172,
"width": 923.328125, "height": 44, "top": 172, "right": 1341.765625, "bottom": 216, "left": 418.4375 }
@juanlizarazog DOMRect is just a rectangle
@juanlizarazog element.getBoundingClientRect(); 1. element.getClientRects(); 2. Returns a DOMRectList 3. Returns
the union of these rectangles which is the DOMRect returned by element.getBoundingClientRect(); * Amount of scrolling matters
@juanlizarazog VIEW PORT
@juanlizarazog Let’s see it
@juanlizarazog No. 2 new IntersectionObserver(callback, options);
@juanlizarazog IntersectionObservers let you know when an observed element enters
or exits the browser’s viewport.
@juanlizarazog const options = { root: null, rootMargin: '0px', threshold:
0 } const observer = new IntersectionObserver( callback, options );
@juanlizarazog That’s it, so let’s see it
@juanlizarazog Love your users ❤
@juanlizarazog Thank you! Source code: https://github.com/juanlizarazo/image-lazy-load-demos Slides: https://speakerdeck.com/juanlizarazo/lazy-loading-images-with-the-intersection-observer
More Decks by Juan
See All by Juan
How to Build 3 Winning Hackathon Projects in 24 hours
juanlizarazo
0
48
From $500 and Fear to 10 Rentals
juanlizarazo
0
15
An exciting intro to JavaScript unit testing
juanlizarazo
1
200
Dom manipulation in web workers: The future of your mobile web apps
juanlizarazo
0
97
Create instant loading mobile web pages with AMP
juanlizarazo
0
150
AMP - Accelerated Mobile Pages
juanlizarazo
0
47
Other Decks in Programming
See All in Programming
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
160
The Cost of the DOM
ypresto
2
380
SONY CISC-NEWS NWS-1750 + NWB-225 ハードウェアメンテとフレームバッファカラー対応 / KOF2026
tsutsui
0
140
高速開発を止めずに 性能を上げる Flyleのシステム刷新と改善の歴史
azihsoyn
0
110
선언형 햅틱 라이브러리 진동을 소개합니다
l2hyunwoo
1
330
祈るテストから、探索するテストへ 〜Lincheckではじめる並行処理テスト〜
yyh_gl
0
430
SODA - FACT BOOK(JP)
sodainc
1
40k
社内AIエージェント「Askワンバン」における コストチューニングの取り組み
t0yohei
0
180
Kotlin Fest 2026: Kotlin コンパイラに Contribute してみよう! - Kotlin/Wasm で深い再帰を書けるようにした話
ternbusty
1
420
ruby/uri meets WHATWG
jinroq
0
150
AIコーディングをセッションで終わらせない: PHPライブラリ開発におけるコンテキスト承継設計
ickx
0
110
Compiling Your Language to WasmGC & Friends
tanishiking
0
170
Featured
See All Featured
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
470
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
18k
GitHub's CSS Performance
jonrohan
1033
470k
Into the Great Unknown - MozCon
thekraken
41
2.8k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.7k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3.3k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
1k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
500