const allLinks = document.querySelectorAll("a"); function pageWipeIn() { gsap.to('.page-wipe-in', { scaleY: 1, duration: 0.44, }); } function pageWipeOut() { gsap.to('.page-wipe-out', { scaleY: 0, duration: 0.44, }); } window.addEventListener('load', ()=> { pageWipeOut(); for (const link of allLinks) { link.addEventListener('click', (e)=> { let href = e.currentTarget.getAttribute("href"); if(href.indexOf("#") === -1 && !link.hasAttribute("excluded-from-page-wipe") && link.getAttribute("target") !== "_blank") { e.preventDefault(); console.log("about to wipe in..."); pageWipeIn(); setTimeout(()=> { window.location.href = href; }, 444) } }) } }); window.onpageshow = (e)=> { e.persisted ? window.location.reload() : ''}