This JavaScript code hides elements with the class .entrance-animation after 2 seconds. If the user has visited before, it hides them immediately using LocalStorage to remember their visit.
document.addEventListener("DOMContentLoaded", function () { let elements = document.querySelectorAll(".entrance-animation"); let hasVisited = localStorage.getItem("hideEntrance"); if (hasVisited) { // If the user has already visited, hide elements immediately elements.forEach(function (element) { element.style.display = "none"; }); } else { // If first visit, set timeout to hide after 2 seconds setTimeout(function () { elements.forEach(function (element) { element.style.display = "none"; }); // Store the visit status in localStorage localStorage.setItem("hideEntrance", "true"); }, 2000); // 2 seconds delay } });