Q:

How to make Bootstrap navbar in mobile view like a normal menu

http://www.bootply.com/y1iaZwCCct
I'm using this menu in my website but couldn't change the default settings. I need a script in jQuery which makes two things to the menu in mobile-view.

Close when i click on a link.
Close when i click outside the menu.

I`m new to jQuery so any help would be appreciated. Thank you.

A:

FOUND THE SOLUTION......

Use data-toggle="collapse" and data-target=".in" on a-tags or list element to close the menu when a link is clicked.
this code to close the menu when we clicked outside the menu
$(document).click(function (event) {
    var clickover = $(event.target);
    var $navbar = $(".navbar-collapse");               
    var _opened = $navbar.hasClass("in");
    if (_opened === true && !clickover.hasClass("navbar-toggle")) {      
        $navbar.collapse('hide');
    }
});

