Emma Louise, surrounded by girls

{ entries.forEach(entry=>{ if (entry.isIntersecting) { scrollToTop.style.bottom = "5em"; scrollToTop.classList.add("showScrollToTop") } else { if (scrollToTop.classList.contains("showScrollToTop") && entry.boundingClientRect.y > 0) { scrollToTop.classList.remove("showScrollToTop"); scrollToTop.addEventListener("transitionend", removeScrollFromView) } } } ) } ); function removeScrollFromView() { scrollToTop.removeEventListener("transitionend", removeScrollFromView); if (scrollToTop.classList.contains("showScrollToTop")) { return } scrollToTop.style.bottom = "-200px" } if (post[2]) { observer.observe(post[2]); scrollToTop.addEventListener("click", ()=>{ window.scrollTo({ top: 0, behavior: "smooth" }) } ); }