JavaScript Close on Click

Hi ,
I have this nav-bar https://codepen.io/raul-rogojan/pen/LoOoVm .
I have managed to make it work on outside click with the help of somebody but I would like it to close after I click on About for example and I have no idea how I should do that.
Keep in mind that I an now to coding and JavaScript is my worse nightmare. :smiley:
Thanks !

Is this what you meant?

https://codepen.io/libraminh/pen/wbLOBx?editors=0010

// Handle close bar
const closeNavbar = () => {
  $('.nav-links').removeClass('nav-activ')
}

// Toggle hamburger animation
const toggleHamburgerBtn = () => {
  $(".burger").toggleClass('animation')
}

// Handle change link
const changeLink = () => {
  $('.nav-links a').on('click', () => {
    closeNavbar()
    toggleHamburgerBtn()
  })
}
1 Like

Yess !! And I understend it too hahah . 

Sorry , I am new to coding and I get excited when I understend stuff :D 

1 Like