SAE15_2022/assets/js/header.js

12 lines
414 B
JavaScript

function burgerMenu() {
const btn = document.getElementById("burger-menu");
const menu = document.getElementById("menu");
if (btn.src.endsWith("assets/img/open-menu.svg")) {
btn.src = btn.src.replace("open-menu.svg", "close-menu.svg");
menu.className = "";
} else {
btn.src = btn.src.replace("close-menu.svg", "open-menu.svg");
menu.className = "invisible";
}
}