57 lines
2.0 KiB
JavaScript
57 lines
2.0 KiB
JavaScript
// function toggleMenu() {
|
|
// var buttonElement = document.getElementById('menuIcon');
|
|
//
|
|
// var htmlElement = document.getElementsByTagName('html')[0];
|
|
// var logoElement = document.getElementById('sdeLogo');
|
|
// var mainElement = document.getElementsByTagName('main')[0];
|
|
//
|
|
// var menu = document.getElementById('menu');
|
|
//
|
|
// if(buttonElement.alt === '-')
|
|
// {
|
|
// htmlElement.style.backgroundColor = 'rgb(0, 120, 138)';
|
|
// logoElement.src = '/images/logos/Logo-hvid.svg';
|
|
// menu.classList.remove('d-none');
|
|
// mainElement.classList.add('d-none');
|
|
//
|
|
// buttonElement.alt = 'X';
|
|
// }
|
|
// else
|
|
// {
|
|
// htmlElement.style.backgroundColor = 'rgb(255, 255, 255)';
|
|
// logoElement.src = '/images/logos/Logo-normal.svg';
|
|
// menu.classList.add('d-none');
|
|
// mainElement.classList.remove('d-none');
|
|
//
|
|
// buttonElement.alt = '-';
|
|
// }
|
|
// }
|
|
|
|
function toggleMenu(menu) {
|
|
let menuElement = document.getElementById(menu);
|
|
let logoElement = document.getElementById("sdeLogo");
|
|
let htmlElement = document.getElementsByTagName('html')[0];
|
|
let mainElement = document.getElementsByTagName('main')[0];
|
|
let iconElement = document.getElementById("icon");
|
|
|
|
if(menuElement.classList.contains("hide")) {
|
|
menuElement.classList.remove("hide");
|
|
mainElement.classList.remove("d-none");
|
|
htmlElement.style.backgroundColor = 'rgb(255, 255, 255)';
|
|
logoElement.src = '/images/logos/Logo-normal.svg';
|
|
iconElement.classList.remove("fa-times");
|
|
iconElement.classList.add("fa-bars");
|
|
} else {
|
|
menuElement.classList.add("hide");
|
|
mainElement.classList.add("d-none");
|
|
htmlElement.style.backgroundColor = 'rgb(0, 120, 138)';
|
|
logoElement.src = '/images/logos/Logo-hvid.svg';
|
|
iconElement.classList.remove("fa-bars");
|
|
iconElement.classList.add("fa-times");
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
toggleMenu
|
|
};
|