Lazy loading JS by visibility
Created on 2023-02-06T21:37:27-06:00
- Insert a script at the end of the page so it will not run until the entire page has downloaded.
- The script registers an observer to run a callback whenever a given div comes on to the screen.
- The observer causes the javascript for the site to be downloaded and activated only when that section has come in to view.