From 81050184eb3444ec42c635c9e2268a2f5f8d0946 Mon Sep 17 00:00:00 2001 From: Alain Takoudjou Date: Sun, 28 Mar 2021 22:29:04 +0200 Subject: [PATCH] Fix detecting if mobile css layout is enabled Use matchMedia to check if mobile css is enabled instead of checking window innerwidth size. --- static/galene.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/static/galene.js b/static/galene.js index 8cbe3eb..663f3e1 100644 --- a/static/galene.js +++ b/static/galene.js @@ -40,12 +40,6 @@ let serverConnection; let fallbackUserPass = null; -/* max-device-width which is defined in css for mobile layout */ -/** - * @type {number} - */ -let mobileViewportWidth = 1024; - /** * @param {string} username * @param {string} password @@ -260,8 +254,9 @@ function reflectSettings() { } function isMobileLayout() { - let width = window.innerWidth; - return width <= mobileViewportWidth; + if (window.matchMedia('only screen and (max-width: 1024px)').matches) + return true; + return false; } /**