我正在尝试使默认的bootstrap导航栏工作,但切换似乎不起作用。我真的不知道为什么:
<div class="navbar navbar-inverse">
<div class="container">
<div class="navbar-header">
<a href="" class="navbar-brand">My Website</a>
<button type="button" class="navbar-toggle" datatoggle="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>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="">Page 1</a></li>
<li><a href="">Page 2</a></li>
<li><a href="">Page 3</a></li>
</ul>
</div>
</div>
</div>
答案 0 :(得分:3)
下次仔细检查您的代码:)
<button type="button" class="navbar-toggle" datatoggle="collapse" data-target=".navbar-collapse">
将datatoggle
更改为data-toggle
。