Created
June 30, 2018 16:57
-
-
Save agneym/c3d8b8e429fbfc4622fb1a88924a6257 to your computer and use it in GitHub Desktop.
This file contains 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
var observer = new IntersectionObserver(changes => { | |
for (const change of changes) { | |
console.log(change.time); // Timestamp when the change occurred | |
console.log(change.rootBounds); // Unclipped area of root | |
console.log(change.boundingClientRect); // target.boundingClientRect() | |
console.log(change.intersectionRect); // boundingClientRect, clipped by its containing block ancestors, and intersected with rootBounds | |
console.log(change.intersectionRatio); // Ratio of intersectionRect area to boundingClientRect area | |
console.log(change.target); // the Element target | |
} | |
}, {}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment