kh3_website/js/loading-screen.js

17 lines
662 B
JavaScript

// Loading screen functionality
document.addEventListener("DOMContentLoaded", function () {
// Loading screen with improved timing
window.addEventListener("load", () => {
const loadingScreen = document.getElementById("loadingScreen");
if (loadingScreen) {
// Show loading screen briefly, then fade out just before animations start
setTimeout(() => {
loadingScreen.style.transition = "opacity 0.3s ease-out";
loadingScreen.style.opacity = "0";
setTimeout(() => {
loadingScreen.style.display = "none";
}, 300);
}, 400); // Reduced from 1000ms to 400ms to sync with animations
}
});
});