After trying to close the navbar by clicking outside of it, I implemented this code:
$(document).on('click',function(){
if(!$('#top_right_menu_btn').hasClass('open')) {
$('#myNavbar').collapse('hide');
}
});
However, I noticed that it closes the drop-down menu even when I click on it. I want to prevent it from closing when clicking on it.
Visit my site (the nav bar will appear when the screen size is below 768px)