From 1e4e71ad9c563ba64112609947fc308a930c5014 Mon Sep 17 00:00:00 2001 From: engineerTrooper Date: Tue, 8 Dec 2020 16:33:34 +0100 Subject: [PATCH] VENOM-10: added new function isMobileDevice --- public/theme/admin/js/scripts.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/public/theme/admin/js/scripts.js b/public/theme/admin/js/scripts.js index c943fb7..0bf8cc0 100644 --- a/public/theme/admin/js/scripts.js +++ b/public/theme/admin/js/scripts.js @@ -679,6 +679,21 @@ class FormHandler { customElements.define("v-editor", VEditor); })(); +(() => { + const mobileBreakpoint = 1023; + const main = $('main'); + + function isMobileDevice() { + return window.matchMedia("(max-width: " + mobileBreakpoint + "px)").matches; + } + window.isMobileDevice = isMobileDevice; + $('body').addDelegatedEventListener('click', '.nav-toggle', (e, el) => { + if (isMobileDevice()) { + main.classList.toggle('nav-open'); + } + }); + +})(); (() => { class Router { constructor(options) {