2023-07-21 12:25:33 +00:00
|
|
|
const nav = document.querySelector('nav');
|
|
|
|
const button = document.querySelector('.nav-toggle');
|
|
|
|
|
2023-06-18 18:06:01 +00:00
|
|
|
let navRotate = 0;
|
|
|
|
let increment = 45;
|
|
|
|
|
|
|
|
function toggleNav() {
|
|
|
|
navRotate += increment;
|
2023-07-21 12:25:33 +00:00
|
|
|
button.querySelector('svg').style.transform = `rotate(${navRotate}deg)`;
|
2023-06-18 18:06:01 +00:00
|
|
|
|
|
|
|
if (nav.classList.contains('open')) {
|
|
|
|
document.querySelector('body').style.overflow = 'auto';
|
|
|
|
|
|
|
|
nav.classList.remove('open');
|
|
|
|
setTimeout(() => {
|
|
|
|
nav.style.display = 'none';
|
|
|
|
}, 100);
|
|
|
|
|
|
|
|
button.classList.remove('open');
|
|
|
|
} else {
|
|
|
|
document.querySelector('body').style.overflow = 'hidden';
|
|
|
|
|
|
|
|
nav.style.display = 'flex';
|
|
|
|
setTimeout(() => {
|
|
|
|
nav.classList.add('open');
|
|
|
|
}, 3);
|
|
|
|
|
|
|
|
button.classList.add('open');
|
|
|
|
}
|
|
|
|
}
|