04/18 fix web app responsive
This commit is contained in:
@@ -2645,6 +2645,34 @@ const Vault = (() => {
|
||||
});
|
||||
}
|
||||
|
||||
// Mobile sidebar: hamburger opens overlay, backdrop/item-click closes it
|
||||
const backdrop = document.getElementById("sidebar-backdrop");
|
||||
const mobileMenuBtn = document.getElementById("btn-mobile-menu");
|
||||
function openMobileSidebar() {
|
||||
sidebar?.classList.add("mobile-open");
|
||||
backdrop?.classList.add("open");
|
||||
document.body.style.overflow = "hidden";
|
||||
}
|
||||
function closeMobileSidebar() {
|
||||
sidebar?.classList.remove("mobile-open");
|
||||
backdrop?.classList.remove("open");
|
||||
document.body.style.overflow = "";
|
||||
}
|
||||
mobileMenuBtn?.addEventListener("click", openMobileSidebar);
|
||||
backdrop?.addEventListener("click", closeMobileSidebar);
|
||||
// Close mobile sidebar whenever a nav item is clicked
|
||||
document.querySelectorAll(".sidebar-item").forEach((item) => {
|
||||
item.addEventListener("click", () => {
|
||||
if (window.innerWidth <= 640) closeMobileSidebar();
|
||||
});
|
||||
});
|
||||
// Mobile FAB mirrors the desktop add-item button
|
||||
document
|
||||
.getElementById("btn-add-item-mobile")
|
||||
?.addEventListener("click", () => {
|
||||
document.getElementById("btn-add-item")?.click();
|
||||
});
|
||||
|
||||
if (!VaultSession.getKey()) {
|
||||
showUnlockOverlay();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user