simplify
This commit is contained in:
parent
b35514c23b
commit
ec7319b5a8
1 changed files with 6 additions and 7 deletions
|
@ -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();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue