单击导航栏外部时关闭折叠导航栏
jQuery('body').bind('click', function(e) {
if(jQuery(e.target).closest('#navbar').length == 0) {
// click happened outside of .navbar, so hide
var opened = jQuery('.navbar-collapse').hasClass('collapse in');
if ( opened === true ) {
jQuery('#navbar2 .navbar-collapse').collapse('hide');
}
}
});