Navbar没有变成汉堡或反应灵敏

时间:2017-11-27 10:21:08

标签: jquery html css twitter-bootstrap nav

我已经尝试自定义导航栏,我已经从3.0的自举网站复制了基本导航栏。现在,我的导航不会变成汉堡导航,自定义背景图像我用于导航棒,徽标棒,但导航按钮消失。我假设他们在背景图像下方或屏幕外变成汉堡。



.navbar {
  background: url(../images/mainnav.png) no-repeat top center;
  border-radius: 0;
  border: 0;
  height: 100px;
  width: 980px;
  margin: 0 auto;
  display: block;
}

.navspace {
  padding: 30px 46px 30px 46px;
}

.navposition {
  margin-left: 100px;
}

.navbar-brand {
  padding: 0;
  position: relative;
  left: 40px;
  top: 10px;
}

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="container nopadding">
    <nav class="navbar navbar-default navbar-static-top">
        <div class="container">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data- toggle="collapse" data-target="bs-example-navbar-collapse-1" aria- expanded="false">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>max-width: 100%
                <a class="navbar-brand" href="#"><img src="images/logo.png" alt=""></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">
              </ul>
            </li>
          </ul>
          <ul class="nav navbar-nav navposition">
            <li class="navspace"><a href="#">Home</a></li>
            <li class="navspace"><a href="#">Menu</a></li>
            <li class="navspace"><a href="#">Location</a></li>
            <li class="navspace"><a href="#">Contact Us</a></li>
          </ul>
        </div><!-- /.navbar-collapse -->
        </div>
        <!-- /.container-fluid -->
    </nav>
    <div class="row">
        <div class="col-sm-12 banner ">
            <p>10% off all pizzas
                <br>this weekend only</p>
            <h1>LIMITED TIME<br>ONLY</h1>
        </div>
    </div>
    <div class="row thumbnails">
        <div class="col-sm-offset-1 col-sm-3">
            <img src="images/bodyimg.png" alt="">
        </div>
        <div class="col-sm-offset-1 col-sm-3"></div>
        <div class="col-sm-offset-1 col-sm-3"></div>
    </div>
    <div class="row">
        <div class="col-sm-offset-1 col-sm-3"></div>
        <div class="col-sm-offset-1 col-sm-3"></div>
        <div class="col-sm-offset-1 col-sm-3"></div>
    </div>
    <div class="row">
        <div class="col-sm-12"></div>
    </div>
</div>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:-2)

我遇到了同样的问题。我的解决方案是为css中的图标栏设置背景颜色:

.icon-bar {
    background-color: black;
}