The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Close div when clicking outside it

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #198404

    I have this responsive navigation which goes into a dropdown menu when the screen size is too small.
    However, the trigger of the navigation that opens the navigation gets left behind the navigation.
    Okay, easily fixed with z-index.
    But many people might not realize that they have to press the small button to close it (especially on mobile), so I’d like it to close when user clicks anywhere else than the navigation.
    (CodePen didn’t seem to like jQuery?)

    Could you help me out, I’m a total noob in JS?


    May you forgot to add the library in the JS settings at Codepen?

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.