navbar-toggle collapse不会出现

时间:2017-04-04 17:28:13

标签: javascript jquery html css twitter-bootstrap

对于我的导航栏,导航栏切换折叠类不起作用,即当我减小页面大小时,没有按钮出现,但其他元素会崩溃,崩溃。

<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header" style="padding: 10px;">
  <button type="button" class="navbar-toggle collapse" 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 class="navbar-brand" href="#" style="font-size: 40px">LIVIE</a>
</div>

<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
  <ul class="nav navbar-nav">
      <li class="dropdown" style="padding: 10px;">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown" style="font-size: 40px">V <span class="caret"></span></a>
      <ul class="dropdown-menu" role="menu">
        <li><a href="#">Action</a></li>
        <li><a href="#">Another action</a></li>
        <li><a href="#">Something else here</a></li>
        <li class="divider"></li>
        <li><a href="#">Separated link</a></li>
        <li class="divider"></li>
        <li><a href="#">One more separated link</a></li>
      </ul>
    </li>
  </ul>
    <form class="navbar-form navbar-left" role="search" style="padding: 10px;">
    <div class="form-group">
        <input type="text" class="form-control" placeholder="Search" style="width: 400px">
    </div>
    <button type="submit" class="btn btn-default">Submit</button>
  </form>
    <ul class="nav navbar-nav navbar-right" style="
    padding: 10px;">
    <li><div class="stars">
  <form action="">
<input class="star star-5" id="star-5" type="radio" name="star"/>
<label class="star star-5" for="star-5"></label>
<input class="star star-4" id="star-4" type="radio" name="star"/>
<label class="star star-4" for="star-4"></label>
<input class="star star-3" id="star-3" type="radio" name="star"/>
<label class="star star-3" for="star-3"></label>
<input class="star star-2" id="star-2" type="radio" name="star"/>
<label class="star star-2" for="star-2"></label>
<input class="star star-1" id="star-1" type="radio" name="star"/>
<label class="star star-1" for="star-1"></label>
<br/>
<h4 style="padding-left:40%;padding-top: 30px;color: white">NAME</h4>
</form>
</div></li>
<li> <a class=" glyphicon glyphicon-envelope" href="#" style=";font-size: 
36px;color: white;margin-left: 20px;" id="notify" ></a></li>
<li><a class=" glyphicon glyphicon-user" href="#" style=";font-size: 
 36px;color: white;margin-left: 20px;" id="open"></a></li>
 </ul>
 </div><!-- /.navbar-collapse -->

 

当我开始缩小页面大小时,右边的元素也会降低 请帮忙。

1 个答案:

答案 0 :(得分:0)

从切换按钮中删除collapse类..

<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>

http://www.bootply.com/0PL7Fg7Yw8

您还需要清理HTML。它缺少2个结束标记。