我正在构建一个应该贴在页面顶部的navbar
。我用.navbar-fixed-top
类来完成它并给了body元素,填充70px
。现在处于折叠模式(移动分辨率),当切换时,它提供垂直导航。
不确定此滚动的来源。
以下是代码:
<header class=" container-fluid navbar-fixed-top">
<!-- header navbar -->
<nav class="navbar navbar-default">
<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>
<a class="navbar-brand" href="market.html"><img src="images/logo-inner.jpg" / alt="B-Hive: Expand your business"></a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<!-- Form search start -->
<form class="navbar-form navbar-left" role="search" class="top-search-padding">
<div class="form-group">
<div class="search-div ui-widget">
<input id="tags" type="text" class="txt-search" placeholder="Search people, products and services">
<button type="submit" class="btn-search"><img src="images/search-icon.png" /></button>
</div>
</div>
</form>
<!-- Form search end -->
<ul class="nav navbar-nav navbar-right">
<li class="top-menu-links-active"><a href="#">MARKET</a></li>
<li><a class="top-menu-links" href="#">EXHIBITIONS</a></li>
<li><a class="top-menu-links" href="#">MESSAGES</a></li>
<li><a class="top-menu-links" href="#">DASHBOARD</a></li>
<li><a class="top-menu-links" href="#">CART</a></li>
<li class="profile-pic-padding"></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle custom-dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><img class="" src="images/profile-pic.fw.png" /> <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Account</a></li>
<li><a href="#">Privacy</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">Switch Accounts</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">Language <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">EN</a></li>
<li><a href="#">ع</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
<!-- /header navbar -->
</header>
答案 0 :(得分:0)
不要在顶部使用标题,只需从导航
开始 <nav class="navbar navbar-default">
<div class="container-fluid">
<!-- 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>
<a class="navbar-brand" href="#">Brand</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="active"><a href="#">Link <span class="sr-only">(current)</span></a></li>
<li><a href="#">Link</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"
role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span
class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">Separated link</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">One more separated link</a></li>
</ul>
</li>
</ul>
<form class="navbar-form navbar-left" role="search">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
<ul class="nav navbar-nav navbar-right">
<li><a href="#">Link</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"
role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span
class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
答案 1 :(得分:0)
试试这个。
OFFSET1=`date +%y%m%d -d "2 day ago"`
还提到这个文件: Bootstrap.min.css,bootstrap.min.js&amp; jquery.min.js
答案 2 :(得分:0)
Bootstrap的.navbar-collapse
有一个默认max-height: 340px;
,当导航内的链接超过此高度时会导致滚动条出现。
您只需删除此属性即可避免滚动条显示在移动视图中。