我使用了span类图标栏来调整窗口大小后显示三行符号,其他组件应显示在该图标下。但是当我调整窗口大小时,它只显示该图标,点击它后没有任何反应 这就是我所做的: 出了什么问题? 提前谢谢
<body>
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<! Header -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#topNavBar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="{% url 'ontheway:index' %}"> Way2go </a>
</div>
<! Items -->
<div class="collapse navbar-collapse" id="#topNavBar">
<ul class="nav navbar-nav">
<li class="active">
<a href="{% url 'ontheway:index' %}">
<span aria-hidden="true"></span> Home
</a>
</li>
<li class="">
<a href="#">
<span aria-hidden="true"></span> Hotels
</a>
</li>
<li class="">
<a href="#">
<span aria-hidden="true"></span> Homestays
</a>
</li>
</ul>
<form class="navbar-form navbar-left" role="search" method="get" action="#">
<div class="form-group">
<input type="text" class="form-control" name="q" value=""placeholder="Search tourist places,hotels, homestays here">
</div>
<button type="submit" class="btn btn-default"> Search</button>
</form>
<ul class="nav navbar-nav navbar-right">
<li class="">
<a href="#">
<span class="glyphicon glyphicon-bell" aria-hidden="true"></span> Notifications
</a>
<li class="">
<a href="#">
<span aria-hidden="true"></span> Log in
</a>
</li>
<li class="">
<a href="#">
<span aria-hidden="true"></span> Sign up
</a>
</li>
</ul>
</div>
</div>
</nav>
答案 0 :(得分:0)
@pratik jaiswal,您的问题源于您的id
类元素的collapse
属性值。
<!-- Header ---->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#topNavBar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="{% url 'ontheway:index' %}"> Way2go </a>
</div>
<!-- Items ---->
<div class="collapse navbar-collapse" id="#topNavBar"> <!--Take out the hash symbol-->
...
你有一个领先的#
。如果你把它拿出来,你的问题就会得到解决。
您可以在此codeply中看到它的实际效果。