fix inits

This commit is contained in:
MLH
2024-12-22 02:23:48 +01:00
parent d5c697afdf
commit 65a5753f59
9 changed files with 79 additions and 46 deletions

View File

@ -122,12 +122,16 @@ function createHalloween() {
}
}
// initialize halloween after the DOM is loaded
if (!halloween) return; // exit if halloween is disabled
createHalloween();
toggleHalloween();
// initialize halloween
function initializeHalloween() {
if (!halloween) return; // exit if halloween is disabled
createHalloween();
toggleHalloween();
const screenWidth = window.innerWidth; // get the screen width to detect mobile devices
if (randomSymbols && (screenWidth > 768 || randomSymbolsMobile)) { // add random halloweens only on larger screens, unless enabled for mobile devices
addRandomSymbols(halloweenCount);
const screenWidth = window.innerWidth; // get the screen width to detect mobile devices
if (randomSymbols && (screenWidth > 768 || randomSymbolsMobile)) { // add random halloweens only on larger screens, unless enabled for mobile devices
addRandomSymbols(halloweenCount);
}
}
initializeHalloween();