mirror of
https://github.com/stan-turing/website.git
synced 2025-03-06 20:53:28 +01:00
Fixed Menu Autoclose on click of button
This commit is contained in:
parent
9d66b9e507
commit
90a4e9e740
3 changed files with 12 additions and 9 deletions
|
@ -90,13 +90,6 @@
|
|||
<a class="footer-link" href="imprint.html">Impressum</a>
|
||||
<p class="copyright">© 2023 - <span id="year"></span> Patrick Gerhartz | Alle Rechte vorbehalten.</p>
|
||||
</div>
|
||||
<script>
|
||||
hamburger = document.querySelector(".hamburger");
|
||||
hamburger.onclick = function() {
|
||||
navBar = document.querySelector(".nav-bar");
|
||||
navBar.classList.toggle("active");
|
||||
}
|
||||
document.getElementById("year").innerHTML = new Date().getFullYear();
|
||||
</script>
|
||||
<script src="script.js"></script>
|
||||
</body>
|
||||
</html>
|
12
script.js
12
script.js
|
@ -2,4 +2,14 @@ hamburger = document.querySelector(".hamburger");
|
|||
hamburger.onclick = function() {
|
||||
navBar = document.querySelector(".nav-bar");
|
||||
navBar.classList.toggle("active");
|
||||
}
|
||||
}
|
||||
|
||||
const menuButtons = document.querySelectorAll(".nav-bar a");
|
||||
menuButtons.forEach(button => {
|
||||
button.addEventListener("click", () => {
|
||||
const navBar = document.querySelector(".nav-bar");
|
||||
navBar.classList.remove("active"); // Menü schließen
|
||||
});
|
||||
});
|
||||
|
||||
document.getElementById("year").innerHTML = new Date().getFullYear();
|
||||
|
|
Loading…
Add table
Reference in a new issue