dimanche 21 novembre 2021

I dont know javascript and need assistance with a html navbar function

So here is the code

what is worng with it? it should trigger a block if I click on this block (burger) the nav-active function should be triggered. Here is the css part:

const navSlide = () => {
    const burger = document.querySelector('.burger');
    const nav = document.querySelectorAll('.nav-links');

    burger.addEventListener('click',()=>{
        nav.classList.toggle('nav-active');
    });
}

navSlide();
.nav-active {
    transform: translate(0%);
}

I added the javascript file at the end of my html file:

<script src="../static/java_file.js"></script>



Aucun commentaire:

Enregistrer un commentaire