mirror of
https://github.com/Fluffy-Bean/Fluffys-website.git
synced 2024-12-28 18:26:05 +00:00
31 lines
765 B
JavaScript
31 lines
765 B
JavaScript
let navRotate = 0;
|
|
let increment = 45;
|
|
|
|
function toggleNav() {
|
|
let nav = document.querySelector('nav');
|
|
let button = document.querySelector('.nav-toggle');
|
|
|
|
navRotate += increment;
|
|
button.style.transform = `rotate(${navRotate}deg)`;
|
|
|
|
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');
|
|
}
|
|
}
|