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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Juan
November 06, 2018
Programming
90
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
More Decks by Juan
See All by Juan
An exciting intro to JavaScript unit testing
juanlizarazo
1
190
Dom manipulation in web workers: The future of your mobile web apps
juanlizarazo
0
95
Create instant loading mobile web pages with AMP
juanlizarazo
0
150
AMP - Accelerated Mobile Pages
juanlizarazo
0
45
Other Decks in Programming
See All in Programming
半永久的に提供し続けられるプライベートクラウドを目指して ― 利用者の認知負荷を抑えるAPI抽象化とハードウェア世代交代の基盤設計
tomokon
0
500
UPDATE をやめる — EF Core でマスタをバージョン管理する
panda728
PRO
0
1.2k
AmebaブログはKMPから卒業します
kmars0605
0
190
Verilogで学ぶCPU自作入門
uyuki234
8
4.1k
The Rails Doctrine Decade
koic
2
590
外から家のPCの電源入れたい!をPHPで解決する
kawashimo0
1
130
自サークルのIdPからログアウトできるようになるまで
taiseiue
1
140
ジョジョの世界をXRで再現する
mofurune
0
160
Web Framework Benchmark Battle 2026, Any%
a_matsuda
2
2k
GemmaをJevのように使ってみる / Use Gemma like Jev
kishida
5
790
Optunaを作ったときにやりたかったこと、その後 (2026/10/16, Optuna Meetup #3)
iwiwi
1
430
IBM Bob Dojo #1 仕様駆動開発入門
oniak3ibm
PRO
0
390
Featured
See All Featured
Darren the Foodie - Storyboard
khoart
PRO
4
4k
The SEO Collaboration Effect
kristinabergwall1
1
590
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.7k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
2
360
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
380
KATA
mclloyd
PRO
35
16k
Six Lessons from altMBA
skipperchong
29
4.5k
Mobile First: as difficult as doing things right
swwweet
225
10k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
540
Agile that works and the tools we love
rasmusluckow
331
22k
Amusing Abliteration
ianozsvald
1
350
Unsuck your backbone
ammeep
672
58k
Transcript
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