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> <body>
<nav id="nav"> <nav id="nav">
<div id="menu"> <div id="menu" style="display: none;">
<span></span> <span></span>
<div id="blocker"></div> <div id="blocker"></div>
<ul> <ul>
@ -95,6 +95,7 @@
<footer id="footer"> <footer id="footer">
</footer> </footer>
<script defer src="/js/jquery-3.4.1.js"></script>
<script defer src="/js/main.js"></script> <script defer src="/js/main.js"></script>
</body> </body>
</html> </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 //toggle menu burger animation and menu
document.getElementById("menuToggle").addEventListener("mousedown", menuToggle); document.getElementById("menuToggle").addEventListener("mousedown", menuToggle);
function menuToggle() { function menuToggle() {
document.getElementById("menu").classList.toggle("show"); //shows menu //removes menu if disabled and brings it back if enabled
var bars = document.getElementsByClassName('bar'); 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++) { for (var i = 0; i < bars.length; i++) {
bars[i].classList.toggle('active'); bars[i].classList.toggle('active');
} }