我是Bootstrap的新手,只是想让响应式导航工作。当我调整窗口大小时,我会看到折叠的导航栏图标,但它没有显示add
链接。
<div class="container">
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="{{ action('BooksController@index') }}" class="navbar-brand">My Books</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="{{ action('BooksController@create') }}" class="navbar-brand">Add</a></li>
</ul>
</div>
</div>
</nav>
</div>
答案 0 :(得分:0)
我找到了问题的根源。
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
实际上应该是:
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#.navbar-collapse">
data-target
应该是nav div
的类名。