这是我正在使用的代码:
<div class="navbar-wrapper">
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#nav-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="index.html">Project name</a>
</div>
<div class="collapse navbar-collapse" id="#nav-collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="index.html">Home</a></li>
<li><a href="about.html">About</a></li>
<li><a href="work.html">Work</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="#modal-contact-form" data-toggle="modal" data-target="#modal-contact-form">Contact</a></li>
</ul>
</div><!--/.navbar-collapse -->
</div>
</div>
</div>
问题是我无法点击3个图标栏!对此有何解决方案?
我尝试了不同的navbars解决方案,我甚至从bootstrap github上安装了一个并没有工作!
提前致谢!
答案 0 :(得分:4)
ID:
<div class="collapse navbar-collapse" id="#nav-collapse">
应该是:
<div class="collapse navbar-collapse" id="nav-collapse">
<强> Demo 强>
答案 1 :(得分:1)
您的代码失败了,因为您在#
属性中添加了id
字符;它只在data-target
属性中需要。
这是您的菜单,已在Firefox,Chrome和MSIE中修复并确认:
<nav class="navbar-wrapper navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#nav-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="index.html">Project name</a>
</div>
<div class="collapse navbar-collapse" id="nav-collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="index.html">Home</a></li>
<li><a href="about.html">About</a></li>
<li><a href="work.html">Work</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="#modal-contact-form" data-toggle="modal" data-target="#modal-contact-form">Contact</a></li>
</ul>
</div>
</div>
</nav>