Refactor seasonal scripts to enhance mobile detection using matchMedia for responsive behavior
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
const config = window.SeasonalsPluginConfig?.Rain || {};
|
||||
|
||||
const enabled = config.EnableRain !== undefined ? config.EnableRain : true; // enable/disable rain
|
||||
const isMobile = window.innerWidth <= 768;
|
||||
const isMobile = window.matchMedia("only screen and (max-width: 768px)").matches;
|
||||
const elementCount = isMobile ? (config.RaindropCountMobile || 150) : (config.RaindropCount || 300); // count of raindrops
|
||||
const rainSpeed = config.RainSpeed !== undefined ? config.RainSpeed : 1.0; // speed of rain
|
||||
|
||||
|
||||
Reference in New Issue
Block a user