Refactor seasonal scripts to enhance mobile detection using matchMedia for responsive behavior
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user