Coast Creative provides Adobe Business Catalyst e-commerce web development services and SEO for website
designers and online business owners.

Hide the Bootstrap nav-collapse menu on select

Thursday, June 13, 2013

On a mobile device such as an iPhone selecting an item from a collapsed Bootstrap menu (it appears as an icon) does not dismiss the menu, it remains open.

If that's messing with your screen real estate and overall feng shui, here's a quick way to hide it after a user clicks:

$('#myUL a').click(function(e) {
if ($('.btn').is(":visible")) $('.btn').click();

I found this solution at the Bootstrap Google Group. You can see the original post in context here: