add jquery and truly fix menu link

fix so menu links arent clickable while menu is hidden
This commit is contained in:
Felix Schulze 2020-02-22 16:58:55 +01:00
parent a7ad8a1a1e
commit 31ca8d8a12
3 changed files with 10614 additions and 3 deletions

View File

@ -47,7 +47,7 @@
<body>
<nav id="nav">
<div id="menu">
<div id="menu" style="display: none;">
<span></span>
<div id="blocker"></div>
<ul>
@ -95,6 +95,7 @@
<footer id="footer">
</footer>
<script defer src="/js/jquery-3.4.1.js"></script>
<script defer src="/js/main.js"></script>
</body>
</html>

10598
src/js/jquery-3.4.1.js vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,20 @@
//toggle menu burger animation and menu
document.getElementById("menuToggle").addEventListener("mousedown", menuToggle);
function menuToggle() {
document.getElementById("menu").classList.toggle("show"); //shows menu
var bars = document.getElementsByClassName('bar');
//removes menu if disabled and brings it back if enabled
if ($("#menu").css('display') != 'block') {
$("#menu").css('display','block'); //enables menu
setTimeout(function(){
document.getElementById("menu").classList.toggle("show"); //reveals menu
},100);
} else {
document.getElementById("menu").classList.toggle("show"); //hides menu
setTimeout(function(){
$("#menu").css('display','none'); //disables menu
},400);
}
var bars = $('.bar');
for (var i = 0; i < bars.length; i++) {
bars[i].classList.toggle('active');
}