13 lines
431 B
JavaScript
13 lines
431 B
JavaScript
const header_links = document.getElementById("header-links");
|
|
const hamburger = document.getElementById("header-links-toggle");
|
|
|
|
document.addEventListener("click", event => {
|
|
if (!header_links.contains(event.target) && !hamburger.contains(event.target) && !header_links.href) {
|
|
header_links.classList.remove("open");
|
|
}
|
|
});
|
|
|
|
hamburger.addEventListener("click", () => {
|
|
header_links.classList.toggle("open");
|
|
});
|