Skip to content

Instantly share code, notes, and snippets.

@umkasanki
Created March 25, 2020 05:31
Show Gist options
  • Save umkasanki/56296794f7180f13fbcd25b842604b4b to your computer and use it in GitHub Desktop.
Save umkasanki/56296794f7180f13fbcd25b842604b4b to your computer and use it in GitHub Desktop.
Intersection Observer for check position of element
const checkVisability = target => {
const io = new IntersectionObserver((entries, observer) => {
console.log(entries)
entries.forEach(entry => {
if (entry.isIntersecting) {
console.log('visible');
// observer.disconnect();
} else {
console.log('unvisible');
}
});
});
io.observe(target)
};
checkVisability(quoteTable);
@umkasanki
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment