static: make hamburger menu work

This commit is contained in:
Jens Langhammer 2020-05-16 21:11:48 +02:00
parent 8540e787d3
commit 9a9feea5ff
1 changed files with 14 additions and 0 deletions

View File

@ -52,3 +52,17 @@ document.querySelectorAll("input[name=name]").forEach((input) => {
slugField.value = convertToSlug(e.target.value); 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;
}
});