|
| 1 | +document.onreadystatechange = function () { |
| 2 | + if (document.readyState !== "complete") { |
| 3 | + document.querySelector("body").style.visibility = "hidden"; |
| 4 | + document.querySelector("#overlay").style.visibility = "visible"; |
| 5 | + } else { |
| 6 | + document.querySelector("body").style.visibility = "visible"; |
| 7 | + playAnimation(); |
| 8 | + revealTitles(); |
| 9 | + setupHoverTransitions(); |
| 10 | + } |
| 11 | +}; |
| 12 | + |
| 13 | +function revealTitles() { |
| 14 | + ScrollReveal().reveal('.grid-item-container', { |
| 15 | + delay: 0, |
| 16 | + duration: 800, |
| 17 | + distance: '20px', |
| 18 | + origin: 'bottom', |
| 19 | + easing: 'ease-out', |
| 20 | + interval: 100, |
| 21 | + }); |
| 22 | +} |
| 23 | + |
| 24 | +function playAnimation() { |
| 25 | + document.querySelector("#overlay").classList.add("slide-out-overlay"); |
| 26 | +} |
| 27 | + |
| 28 | +function setupHoverTransitions() { |
| 29 | + var gridItemContainers = document.querySelectorAll('.grid-item-container'); |
| 30 | + |
| 31 | + gridItemContainers.forEach(function (container) { |
| 32 | + container.addEventListener('mouseover', function () { |
| 33 | + this.style.transitionDuration = '0.2s'; |
| 34 | + this.style.transform = 'scale(1.02)'; |
| 35 | + }); |
| 36 | + |
| 37 | + container.addEventListener('mouseout', function () { |
| 38 | + this.style.transitionDuration = '0.2s'; |
| 39 | + this.style.transform = 'scale(1)'; |
| 40 | + }); |
| 41 | + }); |
| 42 | +} |
| 43 | + |
| 44 | +document.addEventListener("DOMContentLoaded", function () { |
| 45 | + var links = document.querySelectorAll("a"); |
| 46 | + |
| 47 | + links.forEach(function (link) { |
| 48 | + link.addEventListener("click", function (event) { |
| 49 | + event.preventDefault(); |
| 50 | + var overlay = document.querySelector("#overlay"); |
| 51 | + overlay.classList.add("slide-in-overlay"); |
| 52 | + |
| 53 | + overlay.addEventListener("animationend", function () { |
| 54 | + window.location.href = link.href; |
| 55 | + }); |
| 56 | + }); |
| 57 | + }); |
| 58 | +}); |
0 commit comments