question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Navbar - close the menu when clicking on a link

See original GitHub issue

Hey guys, I was wondering how to close the menu when clicking on an item in a navbar. Here is my current code.

b-navbar(toggleable=true,toggle-breakpoint="sm",type='inverse',variant='custom',fixed='top')
    b-nav-toggle(target='nav_collapse')

    b-collapse#nav_collapse(is-nav)

      //- Left Side
      b-nav(is-nav-bar)
        b-link.navbar-brand(to='/')
          img(:src='$root.customer_image_src || "/static/images/fusionware.png"',style='height:28px;')
        
        b-nav-item(to='/') Dashboard

      //- Right Side
      b-nav.ml-auto(is-nav-bar)
        b-nav-item-dropdown(text='Settings',right-alignment=true)
          b-dropdown-item(to='/clients') Clients

        b-nav-item-dropdown(:text='$root.username',right-alignment=true)
          b-dropdown-item(to='/profile') Profile
          hr
          b-dropdown-item(to='/session/destroy') Logout

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
tmorehousecommented, Jun 30, 2017

@EdwardBiton Glad it is working for you!

If you run into any issues with the latest release, please open an issue.

1reaction
TonBitscommented, Jun 30, 2017

I was literally looking for the nav bar not hidding when clicked and found this and saw your comment that this issue is fixed and released just about 2 hours ago. Did an update with v.0.17.0 and worked perfectly. Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Auto close Navbar when click on link (responsive mode)
this worked for me by adding data-bs-target="#navbarSupportedContent" data-bs-toggle="collapse" to the span tag.inside anchor tag(Nav-Link) ...
Read more >
Menu doesn't close after clicking link - Forum | Webflow
A solution is to add an interaction onto each link in the navbar to move the navmenu element 100% to the right. This...
Read more >
CLICK OUTSIDE OR ON LINKS TO CLOSE NAVBAR - YouTube
JavaScript - How to Create a Responsive Hamburger Menu with HTML, CSS, & JavaScript · Closing Sidebar by Clicking Outside using Javascript |...
Read more >
Closing Sidebar by Clicking Outside using Javascript - YouTube
... Outside using Javascript | Auto Close Sidebar When click on Link ... Sidebar Menu Using Html CSS & Javascript | Dashboard Sidebar...
Read more >
How to make nav links close the collapse menu? #36786
I'm using Bootstrap 5 and Next.js and I'm trying to collapse the Navbar menu when I click a link in mobile view. I've...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found