Refactor santa.js to improve mobile detection for snowflake count adjustment
This commit is contained in:
@@ -310,8 +310,8 @@ function initializeSanta() {
|
||||
}
|
||||
const container = document.querySelector('.santa-container');
|
||||
if (container) {
|
||||
const screenWidth = window.innerWidth; // get the screen width to detect mobile devices
|
||||
if (screenWidth < 768) { // lower count of snowflakes on mobile devices
|
||||
const isMobile = window.matchMedia("only screen and (max-width: 768px)").matches; // check if mobile device
|
||||
if (isMobile) { // lower count of snowflakes on mobile devices
|
||||
isMobile = true;
|
||||
console.log('Mobile device detected. Reducing snowflakes count.');
|
||||
snowflakesCount = snowflakesCountMobile;
|
||||
|
||||
Reference in New Issue
Block a user