Answers for "intersection observer multiple elements"

0

intersection observer multiple elements

const myImgs = document.querySelectorAll('.animate-me');

observer = new IntersectionObserver(entries => {
  entries.forEach(entry => {
    if (entry.intersectionRatio > 0) {
      console.log('in the view');
    } else {
      console.log('out of view');
    }
  });
});

myImgs.forEach(image => {
  observer.observe(image);
});
Posted by: Guest on December-20-2020

Code answers related to "intersection observer multiple elements"

Browse Popular Code Answers by Language