我想让我的导航向下折叠虽然它已经关闭但是当我再次单击该按钮以恢复它时它不起作用。
<div class="menu-btn-respons-container">
<button id="menu-btn" type="button" class="navbar-toggle btn-navbar collapsed" data-toggle="collapse" data-target="#main-menu .navbar-collapse">
<span aria-hidden="true" class="icon_menu hamb-mob-icon"></span>
</button>
</div>
<div id="main-menu" class="font-raleway">
<div class="navbar navbar-default" role="navigation">
<nav class="collapse collapsing navbar-collapse right-1024">
<ul class="nav navbar-nav">
<li>Link 1</li>
<li>Link 2</li>
</ul>
</nav>
</div>
</div>
答案 0 :(得分:0)
我编辑了你的代码,这应该可行。
<nav class="navbar navbar-expand-md navbar-light bg-light fixed-top">
<a class="navbar-brand" href="#"></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
<ul class="navbar-nav mr-auto">
<li>Link 1</li>
<li>Link 2</li>
</ul>
</div>
</nav>