Refactor seasonal scripts to enhance mobile detection using matchMedia for responsive behavior
This commit is contained in:
@@ -84,8 +84,8 @@ function initObjects(count) {
|
||||
function initializeCherryBlossom() {
|
||||
if (!cherryBlossom) return;
|
||||
|
||||
const screenWidth = window.innerWidth;
|
||||
const count = screenWidth > 768 ? petalCount : petalCountMobile;
|
||||
const isMobile = window.matchMedia("only screen and (max-width: 768px)").matches;
|
||||
const count = !isMobile ? petalCount : petalCountMobile;
|
||||
|
||||
initObjects(count);
|
||||
toggleCherryBlossom();
|
||||
|
||||
Reference in New Issue
Block a user