本文介绍了如何在引导程序中添加汉堡菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!
问题描述
我需要一些有关引导导航的帮助.我希望它通过移动设备上的汉堡包图标进行切换.
I need some help with bootstrap nav. I want it to be toggled via a hamburger icon on mobile.
这里是 codepen:http://codepen.io/sadman/pen/hfGwv(链接无效)
Here it is on codepen: http://codepen.io/sadman/pen/hfGwv (link invalid)
.navbar,
.navbar-inverse {
border-radius: 0;
border: none;
margin-bottom: 0;
min-height: 80px;
}
.nav li {
display: inline;
color: white;
}
.navbar-inverse .navbar-nav>li>a {
color: #ffffff;
font-family: Lato;
font-size: 1.7em;
font-weight: 300;
padding: 30px 25px 33px 25px;
}
.navbar-inverse .navbar-nav li a:hover {
background-color: #444444;
transition: 0.7s all linear;
height: 100%;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<nav class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container">
<ul class="nav navbar-nav">
<li><a href="index.php">Home</a></li>
<li><a href="about.php">About</a></li>
<li><a href="#portfolio">Portfolio</a></li>
<li><a href="#">Blog</a></li>
<li><a href="contact.php">Contact</a></li>
</ul>
</div>
</nav>
推荐答案
你所要做的就是阅读 getbootstrap.com 上的代码:
All you have to do is read the code on getbootstrap.com:
Codepen
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<nav class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" 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>
</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><a href="index.php">Home</a></li>
<li><a href="about.php">About</a></li>
<li><a href="#portfolio">Portfolio</a></li>
<li><a href="#">Blog</a></li>
<li><a href="contact.php">Contact</a></li>
</ul>
</div>
</div>
</nav>
这篇关于如何在引导程序中添加汉堡菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!
本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!