Close Navbar When Nav Link is Clicked

Get FREE Marketing Guides & Templates

By default the navbar dropdown stays open when clicked. This can be an issue if you are using name anchor’s or linking to an id like href=”#section”

// Close Bootstrap 3 navbar when a nav item is clicked
$('.navbar-collapse ul li a:not(.dropdown-toggle)').bind('click touchstart', function () {
  $('.navbar-toggle:visible').click();
});


Written by: Jake Lett
I share digital marketing tips and HubSpot tutorials to help marketers and business owners grow their business.

Topic:

Related posts

Tags:

Want to Get Email Updates of New Articles?

Join My Email Newsletter