const sections = document.querySelector('.section--2'); const options = { rootMargin: '0px', threshold: 0.8 } function handleSections(entries){ entries.forEach((entry) => { if(entry.isIntersecting){ entry.target.classList.add() }else{ entry.target.style.backgroundColor = 'transparent' } }) } const sectionObserver = new IntersectionObserver(handleSections, options); sectionObserver.observe(sections)