šŸŽ Help us shape Codewell into a better product for a chance to win one month of Codewell Pro →

  • Spense landing page

    Meena-sekar•a 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.