Adjustments to the mobile menu.
This commit is contained in:
parent
bdbf3b595d
commit
37218ed069
2 changed files with 12 additions and 8 deletions
|
|
@ -7,18 +7,18 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
const body = document.querySelector('body');
|
||||
const nav = document.querySelector('.mobile-nav');
|
||||
const sheet = document.querySelector('.mobile-nav__sheet');
|
||||
const toggle = document.querySelector('.mobile-nav__toggle');
|
||||
|
||||
function navopen() {
|
||||
body.classList.add('js-nav-open');
|
||||
nav.classList.add('js-nav-open');
|
||||
sheet.setAttribute('aria-hidden', 'false');
|
||||
toggle.setAttribute('aria-expanded', 'true');
|
||||
}
|
||||
|
||||
function navclose() {
|
||||
body.classList.remove('js-nav-open');
|
||||
nav.classList.remove('js-nav-open');
|
||||
sheet.setAttribute('aria-hidden', 'true');
|
||||
toggle.setAttribute('aria-expanded', 'false');
|
||||
}
|
||||
|
|
@ -28,7 +28,7 @@
|
|||
toggles.forEach(function (toggle) {
|
||||
toggle.addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
if (body.classList.contains('js-nav-open')) {
|
||||
if (nav.classList.contains('js-nav-open')) {
|
||||
navclose();
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
display: none;
|
||||
}
|
||||
|
||||
.js-nav-open & {
|
||||
&.js-nav-open {
|
||||
position: fixed;
|
||||
}
|
||||
|
||||
|
|
@ -136,12 +136,16 @@
|
|||
&__navbar {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
padding-left: 0;
|
||||
margin-block: 0;
|
||||
|
||||
li {
|
||||
list-style: none;
|
||||
margin: .4rem 0;
|
||||
}
|
||||
|
||||
a {
|
||||
display: inline-block;
|
||||
padding-block: .5rem;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue