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

@ -135,12 +135,16 @@ function initLeaves() {
}
}
// initialize leaves and add random leaves after the DOM is loaded
if (!leaves) return; // exit if leaves are disabled
initLeaves();
toggleAutumn();
// initialize leaves and add random leaves
function initializeLeaves() {
if (!leaves) return; // exit if leaves are disabled
initLeaves();
toggleAutumn();
const screenWidth = window.innerWidth; // get the screen width to detect mobile devices
if (randomLeaves && (screenWidth > 768 || randomLeavesMobile)) { // add random leaves only on larger screens, unless enabled for mobile devices
addRandomLeaves(leafCount);
const screenWidth = window.innerWidth; // get the screen width to detect mobile devices
if (randomLeaves && (screenWidth > 768 || randomLeavesMobile)) { // add random leaves only on larger screens, unless enabled for mobile devices
addRandomLeaves(leafCount);
}
}
initializeLeaves();