/    Sign up×
Community /Pin to ProfileBookmark

JavaScript Close after 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. 😀
Thanks !

to post a comment
CSSJavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@codyhillauthorJun 07.2019 — @RaulRogojan#1604411 Found the solution
Copy linkTweet thisAlerts:
@JMRKERJun 07.2019 — It is a common courtesy to share your solution to problems posed.

Might be of help to someone else with a future problem.
Copy linkTweet thisAlerts:
@codyhillauthorJun 08.2019 — @RaulRogojan#1604437
// 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()
})
}
×

Success!

Help @codyhill spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.12,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...