Ekapp/skolehjem/resources/js/navmenu/menu.js

28 lines
1.0 KiB
JavaScript
Raw Normal View History

2020-06-23 13:32:42 +00:00
function toggleMenu(menu) {
let menuElement = document.getElementById(menu);
2020-06-29 06:13:53 +00:00
let logoElement = document.getElementById("sdeLogo");
let htmlElement = document.getElementsByTagName('html')[0];
let mainElement = document.getElementsByTagName('main')[0];
2020-06-29 06:35:08 +00:00
let iconElement = document.getElementById("icon");
2020-06-29 06:13:53 +00:00
if(menuElement.classList.contains("hide")) {
2020-06-23 13:32:42 +00:00
menuElement.classList.remove("hide");
2020-06-29 06:13:53 +00:00
mainElement.classList.remove("d-none");
htmlElement.style.backgroundColor = 'rgb(255, 255, 255)';
logoElement.src = '/images/logos/Logo-normal.svg';
2020-06-29 06:35:08 +00:00
iconElement.classList.remove("fa-times");
iconElement.classList.add("fa-bars");
2020-06-29 06:13:53 +00:00
} else {
2020-06-23 13:32:42 +00:00
menuElement.classList.add("hide");
2020-06-29 06:13:53 +00:00
mainElement.classList.add("d-none");
htmlElement.style.backgroundColor = 'rgb(0, 120, 138)';
logoElement.src = '/images/logos/Logo-hvid.svg';
2020-06-29 06:35:08 +00:00
iconElement.classList.remove("fa-bars");
iconElement.classList.add("fa-times");
2020-06-29 06:13:53 +00:00
}
}
2020-06-25 13:01:33 +00:00
module.exports = {
toggleMenu
};