Refactor seasonal scripts to enhance mobile detection using matchMedia for responsive behavior

This commit is contained in:
CodeDevMLH
2026-02-28 01:16:01 +01:00
parent cbf5d73629
commit 89ce903e8a
7 changed files with 12 additions and 12 deletions

View File

@@ -167,8 +167,8 @@ function initCarnivalObjects(count) {
function initializeCarnival() {
if (!carnival) return;
const screenWidth = window.innerWidth;
const count = screenWidth > 768 ? carnivalCount : carnivalCountMobile;
const isMobile = window.matchMedia("only screen and (max-width: 768px)").matches;
const count = !isMobile ? carnivalCount : carnivalCountMobile;
initCarnivalObjects(count);
toggleCarnival();