较小的屏幕尺寸上,Bootstrap导航栏切换按钮消失

时间:2016-12-29 06:20:24

标签: html css twitter-bootstrap

我的导航栏完全消失,我只留下navbar-brand课程中的文字。我甚至没有得到切换按钮。

非常感谢任何帮助。

#custom-bootstrap-menu.navbar-default .navbar-brand {
  color: rgba(171, 106, 106, 1);
}
#custom-bootstrap-menu.navbar-default {
  font-size: 14px;
  background-color: rgba(255, 255, 255, 1);
  border-width: 0px;
  border-radius: 4px;
}
#custom-bootstrap-menu.navbar-default .navbar-nav>li>a {
  color: rgba(0, 0, 0, 1);
  background-color: rgba(255, 255, 255, 1);
}
#custom-bootstrap-menu.navbar-default .navbar-nav>li>a:hover,
#custom-bootstrap-menu.navbar-default .navbar-nav>li>a:focus {
  color: rgba(27, 219, 81, 1);
  background-color: rgba(255, 255, 255, 1);
}
#custom-bootstrap-menu.navbar-default .navbar-nav>.active>a,
#custom-bootstrap-menu.navbar-default .navbar-nav>.active>a:hover,
#custom-bootstrap-menu.navbar-default .navbar-nav>.active>a:focus {
  color: rgba(14, 145, 40, 1);
  background-color: rgba(255, 255, 255, 1);
}
#custom-bootstrap-menu.navbar-default .navbar-toggle {
  border-color: #ffffff;
}
#custom-bootstrap-menu.navbar-default .navbar-toggle:hover,
#custom-bootstrap-menu.navbar-default .navbar-toggle:focus {
  background-color: #ffffff;
}
#custom-bootstrap-menu.navbar-default .navbar-toggle .icon-bar {
  background-color: #ffffff;
}
#custom-bootstrap-menu.navbar-default .navbar-toggle:hover .icon-bar,
#custom-bootstrap-menu.navbar-default .navbar-toggle:focus .icon-bar {
  background-color: #ffffff;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />

<div id="custom-bootstrap-menu" class="navbar navbar-default " role="navigation">
  <div class="container-fluid">

    <div class="navbar-header">
      <a class="navbar-brand" href="#">Image</a>
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-menubuilder">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
    </div>

    <div class="collapse navbar-collapse navbar-menubuilder">
      <ul class="nav navbar-nav navbar-right">
        <li><a href="/">Home</a>
        </li>
        <li><a href="/products">Products</a>
        </li>
        <li><a href="/about-us">About Us</a>
        </li>
        <li><a href="/contact">Contact Us</a>
        </li>
      </ul>
    </div>

  </div>
</div>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>

这可能是一些细节,但无论教程如何,我都想念它。

提前谢谢。

3 个答案:

答案 0 :(得分:3)

菜单没有消失,您在自定义css中将其颜色设置为白色(代码的最后几个代码)。我在这里把它变成了红色。

#custom-bootstrap-menu.navbar-default .navbar-brand {
  color: rgba(171, 106, 106, 1);
}
#custom-bootstrap-menu.navbar-default {
  font-size: 14px;
  background-color: rgba(255, 255, 255, 1);
  border-width: 0px;
  border-radius: 4px;
}
#custom-bootstrap-menu.navbar-default .navbar-nav>li>a {
  color: rgba(0, 0, 0, 1);
  background-color: rgba(255, 255, 255, 1);
}
#custom-bootstrap-menu.navbar-default .navbar-nav>li>a:hover,
#custom-bootstrap-menu.navbar-default .navbar-nav>li>a:focus {
  color: rgba(27, 219, 81, 1);
  background-color: rgba(255, 255, 255, 1);
}
#custom-bootstrap-menu.navbar-default .navbar-nav>.active>a,
#custom-bootstrap-menu.navbar-default .navbar-nav>.active>a:hover,
#custom-bootstrap-menu.navbar-default .navbar-nav>.active>a:focus {
  color: rgba(14, 145, 40, 1);
  background-color: rgba(255, 255, 255, 1);
}
#custom-bootstrap-menu.navbar-default .navbar-toggle {
  border-color: #ffffff;
}
#custom-bootstrap-menu.navbar-default .navbar-toggle:hover,
#custom-bootstrap-menu.navbar-default .navbar-toggle:focus {
  background-color: red;
}
#custom-bootstrap-menu.navbar-default .navbar-toggle .icon-bar {
  background-color: red;
}
#custom-bootstrap-menu.navbar-default .navbar-toggle:hover .icon-bar,
#custom-bootstrap-menu.navbar-default .navbar-toggle:focus .icon-bar {
  background-color: white;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />

<div id="custom-bootstrap-menu" class="navbar navbar-default" role="navigation">
  <div class="container-fluid">

    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-menubuilder">
        <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="#">Image</a>
    </div>

    <div class="collapse navbar-collapse navbar-menubuilder">
      <ul class="nav navbar-nav navbar-right">
        <li><a href="/">Home</a>
        </li>
        <li><a href="/products">Products</a>
        </li>
        <li><a href="/about-us">About Us</a>
        </li>
        <li><a href="/contact">Contact Us</a>
        </li>
      </ul>
    </div>

  </div>
</div>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>

答案 1 :(得分:0)

这种情况正在发生,因为您将颜色设置为#ffffff,因此它不会因为相同的背景颜色不可见而消失。刚刚更改为#000000,看起来很不错。

&#13;
&#13;
#custom-bootstrap-menu.navbar-default .navbar-brand {
  color: rgba(171, 106, 106, 1);
}
#custom-bootstrap-menu.navbar-default {
  font-size: 14px;
  background-color: rgba(255, 255, 255, 1);
  border-width: 0px;
  border-radius: 4px;
}
#custom-bootstrap-menu.navbar-default .navbar-nav>li>a {
  color: rgba(0, 0, 0, 1);
  background-color: rgba(255, 255, 255, 1);
}
#custom-bootstrap-menu.navbar-default .navbar-nav>li>a:hover,
#custom-bootstrap-menu.navbar-default .navbar-nav>li>a:focus {
  color: rgba(27, 219, 81, 1);
  background-color: rgba(255, 255, 255, 1);
}
#custom-bootstrap-menu.navbar-default .navbar-nav>.active>a,
#custom-bootstrap-menu.navbar-default .navbar-nav>.active>a:hover,
#custom-bootstrap-menu.navbar-default .navbar-nav>.active>a:focus {
  color: rgba(14, 145, 40, 1);
  background-color: rgba(255, 255, 255, 1);
}
#custom-bootstrap-menu.navbar-default .navbar-toggle {
  border-color: #000000;
}
#custom-bootstrap-menu.navbar-default .navbar-toggle:hover,
#custom-bootstrap-menu.navbar-default .navbar-toggle:focus {
  background-color: #ffffff;
}
#custom-bootstrap-menu.navbar-default .navbar-toggle .icon-bar {
  background-color: #000000;
}
#custom-bootstrap-menu.navbar-default .navbar-toggle:hover .icon-bar,
#custom-bootstrap-menu.navbar-default .navbar-toggle:focus .icon-bar {
  background-color: #ffffff;
}
&#13;
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />

<div id="custom-bootstrap-menu" class="navbar navbar-default" role="navigation">
  <div class="container-fluid">

    <div class="navbar-header"><a class="navbar-brand" href="#">Image</a>
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-menubuilder">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
    </div>

    <div class="collapse navbar-collapse navbar-menubuilder">
      <ul class="nav navbar-nav navbar-right">
        <li><a href="/">Home</a>
        </li>
        <li><a href="/products">Products</a>
        </li>
        <li><a href="/about-us">About Us</a>
        </li>
        <li><a href="/contact">Contact Us</a>
        </li>
      </ul>
    </div>

  </div>
</div>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
&#13;
&#13;
&#13;

答案 2 :(得分:0)

&#13;
&#13;
  override func update(_ currentTime: CFTimeInterval) {
      let elpasedTimeSinceLastupdate = currentTime - startTime
      //Check if enough time has elapsed otherwise there is nothing to do
      guard elpasedTimeSinceLastupdate > requiredTimeIntervale else {
        return
      }
      startTime = currentTime
      // Do stuff here
  }
&#13;
    _ = Timer.scheduledTimer(withTimeInterval: 1, repeats: true) { _ in
        //Do stuff every second here
    }
&#13;
&#13;
&#13;