Activate mobil menu with js since it depends on js.
This commit is contained in:
parent
e058a3dd5b
commit
15f9a7933f
1 changed files with 18 additions and 21 deletions
|
|
@ -4,10 +4,21 @@
|
|||
*/
|
||||
|
||||
(function () {
|
||||
const main_menu = document.querySelector('.main-menu');
|
||||
const header_region = document.querySelector('.header__region');
|
||||
const nav = document.querySelector('.mobile-nav');
|
||||
const sheet = document.querySelector('.mobile-nav__sheet');
|
||||
const toggle = document.querySelector('.mobile-nav__toggle');
|
||||
|
||||
// Switch to mobil menu on small screens.
|
||||
// The mobile menu depends on js so we use js to activate it.
|
||||
const small_screen = window.matchMedia('(max-width: 666px)').matches;
|
||||
if (small_screen) {
|
||||
main_menu.hidden = true;
|
||||
header_region.hidden = true;
|
||||
nav.hidden = false;
|
||||
}
|
||||
|
||||
function navopen() {
|
||||
nav.dataset.navopen = 'true';
|
||||
sheet.setAttribute('aria-hidden', 'false');
|
||||
|
|
|
|||
Loading…
Reference in a new issue