🎁 Help us shape Codewell into a better product for a chance to win one month of Codewell Pro →

  • Spense landing page

    Meena-sekara month ago

    adding active class for menu on/off in mobile view
    var icon =  document.querySelector('.humberger__icon');
    var navbar = document.querySelector('nav');
    var body = document.body

    icon.addEventListener('click', () => {
        if(navbar.classList.contains('is-active'))  {
            navbar.classList.remove('is-active');
            body.classList.remove('no-scroll');
        }
        else {
            navbar.classList.add('is-active');
            body.classList.add('no-scroll');
        }
    });

    • 0
No comments on this solution yet.
Be first to post.
Join Our Slack Channel
Chat and discuss solutions with a growing community of developers.