This commit is contained in:
Mylloon 2024-11-27 20:08:48 +01:00
parent b35514c23b
commit ec7319b5a8
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -113,11 +113,11 @@ window.addEventListener("load", () => {
uncollapse(last_openeded);
}
// Responsive menu
let menuOpen = false;
const button = document.getElementsByTagName("button")[0];
const content = document.getElementsByTagName("main")[0];
let menuOpen = false;
const initialButtonTextContent = button.textContent;
button.addEventListener("click", () => {
const resetPage = () => {
menuOpen = !menuOpen;
if (menuOpen) {
fileTreeElement.style.display = "block";
@ -128,13 +128,12 @@ window.addEventListener("load", () => {
content.style.display = "";
button.textContent = initialButtonTextContent;
}
});
};
button.addEventListener("click", resetPage);
window.addEventListener("resize", () => {
if (menuOpen && window.innerWidth > 640) {
menuOpen = !menuOpen;
fileTreeElement.style.display = "";
content.style.display = "";
button.textContent = initialButtonTextContent;
resetPage();
}
});
});