Hide Bootstrap nav on click: Meteor

Seen a few comments about the version of Bootstrap commonly used by Meteor developments, the menu toggle doesnt close when a user clicks on a link.

 

The solution below is added to the JavaScript associated with whatever the template for the nav-bar is called. When a user clicks anywhere, the nab-bar collapse is hidden.

 

Just makes the UI better.

Template.nav.events({
‘click .addInterest’:function(){
//$(".create-pattern-box").css(‘visibility’, ‘visible’);
$(".create-pattern-box").removeClass("hidden");
},
‘click’:function(){
$(".navbar-collapse").collapse(‘hide’);
}
})

 

 

 

Leave a Reply