Skip to content

Instantly share code, notes, and snippets.

@simbathesailor
Created January 21, 2020 16:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simbathesailor/0ef2579026dc77ad78f5f571caf58551 to your computer and use it in GitHub Desktop.
Save simbathesailor/0ef2579026dc77ad78f5f571caf58551 to your computer and use it in GitHub Desktop.
intersectionobserver.js
let options = {
root: document.querySelector("#scrollArea"), // null
rootMargin: "0px 0px 0px 0px",
threshold: 1.0 // [0, 0.25, 0.50, 0.75, 1]
};
let observer = new IntersectionObserver(callback, options);
let target = document.querySelector("#listItem");
observer.observe(target);
observer.unobserve(target);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment