I tried using the intersection observer to animate my page on scroll but the browser keeps saying the intersection constructor isn't defined. Please I need help sorting this out.
let animate = document.querySelector(".slide");
let observer = new Intersection( (entries) => {
console.log(entries);
});
observer.observe(animate);
CodePudding user response:
There is not Intersection class in JavaScript, the correct class name is IntersectionObserver
, try referencing it correctly:
let observer = new IntersectionObserver( (entries) => {
console.log(entries);
});