combining toggle code and slidetoggle+click outside code



  • I struggle with connecting to javascript (which is at least what I assume Im supposed to do)

    I have a slidetoggle in a navigation-bar that slides up when .item item 1 is clicked and slides down, whenever somewhere outside on the page is clicked.

    at the same time theres a div that toggles(hides) whenever item item-1 is clicked but doesn't toggle back when the slidetoggle is clicked outside, which is what I would like.

    Right now I have a script for the slidetoggle and I have another script for toggling the div in the nav-bar () and what I would like is that nav-bar div hides on slidetoggle and shows on toggle slide-down.

    Finally the nav-bar div also toggles in a manner thats almost like a slidetoggle -- for reasons I do not understand - where I actually wish it would just disapper at once. How is it best to combine all of these commands in one? (slidetoggle stays intact + navbar div toggles + avoid slidetoggle effect on div nav-bar). Here's a codepen jsfiddlehttps://codepen.io/cthornval/pen/eYpwJmO



    refresh page if you can't see the codepen above


Log in to reply