How do we make the menu in bootstrap in mobile closed when clicking on the menu item?

Friends please help a beginner.Thank you in advance.
My menu looks like this:
<div class="main-nav">
 <div class="container">
 <div class="navbar-header">
 <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
 <span class="sr-only">Toggle navigation</span>
 <span class="icon-bar"></span>
 <span class="icon-bar"></span>
 <span class="icon-bar"></span>
</button>
 <a class="navbar-brand" href="#">
 <h1><img class="img-responsive" src="logo.jpg" alt="logo"></h1>
 </a> 
</div>
 <div class="collapse navbar-collapse">
 <ul class="nav navbar-nav navbar-right"> 
 <li class="scroll active"><a href="#home-slider">Item 1</a></li>
 <li class="scroll"><a href="#services">Пункт2</a></li> 
 <li class="scroll"><a href="#portfolio">Item 3</a></li>
 <li class="scroll"><a href="#about-us">Пункт4</a></li>
 <li class="scroll"><a href="#team">Пункт5</a></li>
 <li class="scroll"><a href="#contact">Пункт6</a></li> 
</ul>
</div>
</div>
 </div>
June 14th 19 at 18:10
1 answer
June 14th 19 at 18:12
$('.navbar-nav a').click(function(){
$('.navbar-collapse').hide()
})
Thank you very much. Yes a menu is closed after clicking,but the trouble is that after the Burger was not opened... - nikita.Stracke commented on June 14th 19 at 18:15
find the code where you open a menu, let's see what happens with the Burger and add to the above code - Wade commented on June 14th 19 at 18:18
sorry-did I understand You correctly? prntscr.com/gv929q .Thank you in advance. - nikita.Stracke commented on June 14th 19 at 18:21
Need to find a js menu and see what happens after you click on the x in the menu - Wade commented on June 14th 19 at 18:24
sorry-don't know how... - nikita.Stracke commented on June 14th 19 at 18:27

Find more questions by tags JavaScript