How to make the navbar close on smartphones when using Bootstrap with Meteor?

I never noticed this before, but when I’m using Bootstrap 3 together with Meteor, the following happens:

  • I open the site on a smartphone
  • I tap on the menù icon (the three dashes) and the navigation items menu opens up
  • I tap on an item and Iron Router brings me to that route, but the menu stays open.

Is there an easy way to make the menu close right after tapping on a menu item?

In the meanwhile I solved it with the following event:

'click .navbar li a': function(e) {
  var navbar = $('.navbar-toggle');
  if (navbar && typeof(navbar) !== 'undefined') {
    navbar.click();
  }
}
1 Like

:slight_smile: I had the same question, thanks for answering you own question it helped me :slight_smile:

1 Like