1
0
Fork 0
mirror of https://github.com/Kozea/Radicale.git synced 2025-07-26 17:58:30 +00:00

Implement side menu for narrow screens

This commit is contained in:
Unrud 2020-03-01 20:12:40 +01:00
parent ec4f2a40d6
commit b9c93d3e11
6 changed files with 122 additions and 29 deletions

View file

@ -0,0 +1,15 @@
window.addEventListener("load", function() {
document.querySelector("button[data-name=nav-open]").addEventListener("click", function() {
document.documentElement.classList.add("nav-opened");
});
document.querySelector("button[data-name=nav-close]").addEventListener("click", function() {
document.documentElement.classList.remove("nav-opened");
});
for (let link of document.querySelectorAll("nav a")) {
link.addEventListener("click", function() {
if (link.parentElement.classList.contains("active") || link.parentElement.classList.contains("level4")) {
document.documentElement.classList.remove("nav-opened");
}
});
}
});