diff options
author | Fredrik Jonsson <frjo@xdeb.org> | 2022-08-07 16:47:59 +0300 |
---|---|---|
committer | Fredrik Jonsson <frjo@xdeb.org> | 2022-08-07 16:47:59 +0300 |
commit | f4bdc66a40ff1b43b7de38c37c698fa144d30be3 (patch) | |
tree | 0a8305be2623b170ad5f882826b6d0e02604d5f5 | |
parent | 39b7768b4f35751dbe2a86ce98bf3ce1dd4adb7d (diff) |
Simplify the mobile.js.
-rw-r--r-- | assets/js/mobile.js | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/assets/js/mobile.js b/assets/js/mobile.js index 7e26693..b805e33 100644 --- a/assets/js/mobile.js +++ b/assets/js/mobile.js @@ -7,21 +7,15 @@ 'use strict'; - // Activate the mobil menu for small screens. - if (window.matchMedia && $('.mobile-nav').length) { - var mq = window.matchMedia('(max-width: 999px)'); - if (mq.matches) { - // Toggle the mobile nav sheet. - $('.mobile-nav__cover, .mobile-nav__toggle').handle('click', function () { - $('body').scroll().toggleClass('js-nav-open'); - }); + // Toggle the mobile nav sheet. + $('.mobile-nav__cover, .mobile-nav__toggle').handle('click', function () { + $('body').scroll().toggleClass('js-nav-open'); + }); - // Close the nav sheet after click (needed for anchor links). - $('.mobile-nav__sheet').find('a').on('click', function () { - $('body').removeClass('js-nav-open'); - }); - } - } + // Close the nav sheet after click (needed for anchor links). + $('.mobile-nav__sheet').find('a').on('click', function () { + $('body').removeClass('js-nav-open'); + }); })(u); |