Lacrima132 / Agile-Web-Dev-Project

Forum Project for Agile Web Dev
1 stars 0 forks source link

Opening animation runs forever #22

Closed ipr17 closed 4 months ago

ipr17 commented 4 months ago

We need to limit it so that the opening animation is only viewed by each user once

trebbyyy commented 4 months ago

@daniel

Lacrima132 commented 4 months ago

Modified the javascript, and parts of the html and css, for the splash to keep track of session storage so that it is only run once per session.

document.addEventListener("DOMContentLoaded", (e) => { const splash = document.querySelector(".splash"); console.log(window.location.pathname); if (sessionStorage.getItem("splashScreenSeen") === null) { if ( window.location.pathname === "/" || window.location.pathname === "/home" ) { splash.classList.remove("invis"); // Lock scrolling document.body.style.overflow = "hidden"; if (splash) { jumbleText(); setTimeout(() => { splash.classList.add("hideSplash"); document.body.style.overflow = "auto"; }, 3500); } } sessionStorage.setItem("splashScreenSeen", "true"); } });

.splash.invis { display: none; }

BOUNTIFY