window.onload = () => { const anchors = document.querySelectorAll('a'); const trans1 = document.querySelector('header'); const trans2 = document.querySelector('.background'); const trans3 = document.querySelector('main'); for (let i = 0; i < anchors.length; i++) { const anchor = anchors[i]; if(anchor.classList.contains("notransition")) return; anchor.addEventListener('click', e => { e.preventDefault(); let target = e.target.href; if (target[target.length - 1] == '#') return; trans1.classList.add('out'); trans2.classList.add('out'); trans3.classList.add('out'); setTimeout(() => { window.location.href = target; }, 500); }); } }