HTML & CSS · Senior · Question 73 of 75

Why prefer IntersectionObserver over scroll listeners for lazy loading or reveal effects?

Explanation

Scroll handlers that call getBoundingClientRect() run dozens of times per second and can cause layout thrashing. The observer batches checks off the critical path.

Further reading

Problem with a question

HTML & CSS · Senior · question 73

Test yourself

Take the HTML & CSS · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz