我的引导菜单在移动设备上不起作用。我检了好几次,但看不出错误。一切看起来都不错,id
和data-target
都是正确的。
<div class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button class="navbar-toggle collapsed" data-target="#main-header" data-toggle="collapse" type="button">
<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="/home">
<img alt="Brand" src="assets/img/logo.png">
</a>
</div>
<div class="collapse navbar-collapse" id="#main-header">
<ul class="nav navbar-nav">
<li>
<a href="/demo">Demo1</a>
</li>
<li>
<a href="/demo">Demo1</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<p class="navbar-text">
Welcome, M1 D1
</p>
</li>
</ul>
</div>
</div>
</div>
答案 0 :(得分:1)
更改菜单ID
id="#main-header"
到
id="main-header"