mirror of
https://github.com/Theodor-Springmann-Stiftung/hamann-ausgabe-core.git
synced 2025-10-29 09:15:33 +00:00
32 lines
1.2 KiB
JavaScript
32 lines
1.2 KiB
JavaScript
// Code for showing and hiding the mobile menu
|
|
const openmenu = function () {
|
|
var x = document.getElementById("ha-topnav");
|
|
if (x !== null) x.className += " ha-topnav-collapsed";
|
|
let oldbutton = document.getElementById("openmenubutton");
|
|
if (oldbutton !== null) oldbutton.setAttribute("class", "hidden");
|
|
let newbutton = document.getElementById("closemenubutton");
|
|
if (newbutton !== null) newbutton.setAttribute("class", "");
|
|
};
|
|
|
|
const closemenu = function () {
|
|
var x = document.getElementById("ha-topnav");
|
|
if (x !== null) x.className = "ha-topnav";
|
|
let oldbutton = document.getElementById("closemenubutton");
|
|
if (oldbutton !== null) oldbutton.setAttribute("class", "hidden");
|
|
let newbutton = document.getElementById("openmenubutton");
|
|
if (newbutton !== null) newbutton.setAttribute("class", "");
|
|
};
|
|
|
|
// Menu: Show / Hide Buttons for mobile View
|
|
if (
|
|
document.getElementById("openmenubutton") !== null &&
|
|
document.getElementById("closemenubutton") !== null
|
|
) {
|
|
document
|
|
.getElementById("openmenubutton")
|
|
.addEventListener("click", openmenu);
|
|
document
|
|
.getElementById("closemenubutton")
|
|
.addEventListener("click", closemenu);
|
|
}
|