arimelody.me/public/script/header.js
ari melody 6efd47c6c6 major UI/UX improvements
Signed-off-by: ari melody <ari@arimelody.me>
2024-08-31 01:52:18 +01:00

15 lines
491 B
JavaScript

const header_links = document.getElementById("header-links");
const hamburger = document.getElementById("header-links-toggle");
function toggle_header_links() {
header_links.classList.toggle("open");
}
document.addEventListener("click", event => {
if (!header_links.contains(event.target) && !hamburger.contains(event.target)) {
header_links.classList.remove("open");
}
});
hamburger.addEventListener("click", event => { toggle_header_links(); });