DeepFrontend
Learning Paths
Practice
System Design & DS
Design Studio
Data Structures Curriculum
Real-World Case Studies
Careers
Job Board
Resume Builder
Blog
Sign in
Search
⌘K
Go Pro
Loading compiler resources...
HTML Quiz Practice
Active Recall Drill Session
← Exit Session
Question 1 of 1
medium
HTML
Why is IntersectionObserver preferred over a scroll event listener + getBoundingClientRect() for detecting when an element enters the viewport?
A
IntersectionObserver is the only API that works on mobile devices
B
getBoundingClientRect() forces synchronous layout (reflow) and scroll fires very frequently, causing layout thrashing; IntersectionObserver computes intersection asynchronously and is far cheaper
C
scroll events don't exist in modern browsers
D
There is no meaningful performance difference
Check Answer