Проблема с воспроизведением анимации при посещении личного портфолио.CSS

Разбираемся в CSS
Anonymous
Проблема с воспроизведением анимации при посещении личного портфолио.

Сообщение Anonymous »

У меня есть стартовая анимация, которая должна воспроизводиться в начале посещения веб-сайта, но она не воспроизводится, но воспроизводится, когда путь http://127.0.0.1:5504/index.html, но она должна воспроизводиться, как показано на это http://127.0.0.1:5504, что мне делать?
Вот мой код прикреплен

Код: Выделить всё

const isHomePage =
window.location.pathname === "/" || window.location.pathname === "/index.html" || window.location.pathname.endsWith("/index.html") || window.location.pathname.includes("Portfolio");
// Check if this is a page refresh
const lastLoadTime = localStorage.getItem("lastLoadTime");
const currentTime = new Date().getTime();
const isRefresh = lastLoadTime && currentTime - lastLoadTime < 3000;
// Within 3 seconds considered a refresh
console.log(isRefresh);
// Update last load time
localStorage.setItem("lastLoadTime", currentTime);
const shouldPlayAnimation = isHomePage && (!localStorage.getItem("hasVisited") || isRefresh);
const shouldPlayAnimation = isHomePage && !localStorage.getItem("hasVisited");
console.log(shouldPlayAnimation);
// Only run animations if we're on home page AND animation hasn't played yet
if (shouldPlayAnimation) {
document.body.classList.add("initial-load");
}
Я пробовал вносить изменения в код кое-где, но бесполезно


Подробнее здесь: https://stackoverflow.com/questions/793 ... -portfolio

Вернуться в «CSS»