Created
August 7, 2017 15:55
-
-
Save deanhume/948c59af68c86da9d3b3f2955747a651 to your computer and use it in GitHub Desktop.
Intersection Observer - Browser Support
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// If we don't have support for intersection observer, load the images immediately | |
if (!('IntersectionObserver' in window)) { | |
Array.from(images).forEach(image => preloadImage(image)); | |
} else { | |
// It is supported, load the images | |
observer = new IntersectionObserver(onIntersection, config); | |
images.forEach(image => { | |
observer.observe(image); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment