intersectionobserver isintersecting
// =========== Intersection Observer isIntersecting =====================
// This means, when the Observer intersects with the Element
// It returns TRUE or FALSE
// Here is a small example:
const box = document.querySelector(".box");
const callbackFunction = function(entries){
if(entries[0].isIntersecting) {
entries[0].target.children[0].classList.add("appear");
// Stop observating because we made the Element appear
observer.unobserve(fadeElement);
}
};
const observer = new IntersectionObserver(callbackFunction, {
// Here you can add some Options you can find on the documentation
});
observer.observe(box)