if (screen.width >= 750 & !window.matchMedia('(prefers-reduced-motion: reduce)').matches) { const faders = document.querySelectorAll('.fade-in'); const appearOptions = { treshold: 0, rootMargin: "0px 0px -250px 0px" }; const appearOnScroll = new IntersectionObserver(function ( entries, appearOnScroll ) { entries.forEach(entry => { if (!entry.isIntersecting) { return; } else { entry.target.classList.add('appear'); appearOnScroll.unobserve(entry.target); } }); }, appearOptions); faders.forEach(fader => { appearOnScroll.observe(fader); }); }