Put in order · JavaScript and TypeScript course · Module 8: Events and the DOM

Lazy Loading Steps with IntersectionObserver

Arrange the steps for implementing lazy loading of images with IntersectionObserver:

Items to put in order

  • Call unobserve() after the image loads
  • Set data-src instead of src on images
  • When the image enters the view, copy data-src to src
  • Create an IntersectionObserver with a callback

You can check the correct answer by solving this task in the CodeWorlds game.