Skip to content

Instantly share code, notes, and snippets.

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 CristinaSolana/754139891b5b4462cfd5e0b812944169 to your computer and use it in GitHub Desktop.
Save CristinaSolana/754139891b5b4462cfd5e0b812944169 to your computer and use it in GitHub Desktop.
const options = {
root: null, // use null for viewport
rootMargin: '0px',
threshold: 1.0
};
const observer = new IntersectionObserver(callback, options);
const target = document.querySelector('#someSection');
observer.observe(target);
function callback(entries, observer) {
// fetch some data
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment