Forums

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
    Posts
  • #198404
    CeeDesign
    Participant

    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.

    http://jsfiddle.net/anhagdjt/
    (CodePen didn’t seem to like jQuery?)

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

    #198406
    Shikkediel
    Participant

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

    http://jsfiddle.net/anhagdjt/3/

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