VENOM-10: added new function isMobileDevice

This commit is contained in:
engineerTrooper 2020-12-08 16:33:34 +01:00
parent 2d9fbc3b99
commit 1e4e71ad9c

View file

@ -679,6 +679,21 @@ class FormHandler {
customElements.define("v-editor", VEditor); 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 { class Router {
constructor(options) { constructor(options) {