Skip to content

Instantly share code, notes, and snippets.

@naveed-ahmad
Created July 31, 2019 19:21
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 naveed-ahmad/0902a5b096acd0349172c5c0f22d0779 to your computer and use it in GitHub Desktop.
Save naveed-ahmad/0902a5b096acd0349172c5c0f22d0779 to your computer and use it in GitHub Desktop.
IntersectionObserver.js
root = document.querySelector('#shortcut-menu');
element = document.querySelector("#render_async_bf86d55cff1564565792")
var observer = new IntersectionObserver(function(entries) {
console.log("interaction ", entries)
if (entries[0].intersectionRatio) {
console.log('visible');
} else {
console.log('hidden');
}
}, {
root: root
});
observer.observe(element);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment