From 9a9feea5ffbdeb9dca94aaa525d45c2b8d2fe98d Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sat, 16 May 2020 21:11:48 +0200 Subject: [PATCH] static: make hamburger menu work --- passbook/static/static/passbook/pf.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/passbook/static/static/passbook/pf.js b/passbook/static/static/passbook/pf.js index 4a8780884..31880461e 100644 --- a/passbook/static/static/passbook/pf.js +++ b/passbook/static/static/passbook/pf.js @@ -52,3 +52,17 @@ document.querySelectorAll("input[name=name]").forEach((input) => { slugField.value = convertToSlug(e.target.value); }); }); + +// Hamburger Menu +document.querySelector(".pf-c-page__header-brand-toggle>button").addEventListener("click", (e) => { + const sidebar = document.querySelector(".pf-c-page__sidebar"); + if (sidebar.classList.contains("pf-m-expanded")) { + // Sidebar already expanded + sidebar.classList.remove("pf-m-expanded"); + sidebar.style.zIndex = 0; + } else { + // Sidebar not expanded yet + sidebar.classList.add("pf-m-expanded"); + sidebar.style.zIndex = 200; + } +});