css代码:

.kch_nav{width: 100%; position: fixed;z-index: 999;top:0;left: 0;right: 0;height: 69px;background-color: #fff;border-bottom: 1px solid #ccc;}
.kch_nav_cont{width: 80%;right: 0px; left: 0px;top:0;position: inherit;margin: 0 auto;}
.kch_nav_logo{width: 100%;float: left;position: relative;z-index: 1000;}
.kch_nav_logo>a>img{margin-top: 0px; margin-left: 0px;padding-top: 8px; padding-bottom: 8px;}
.kch_nav_menu{width: 100%;text-align: right;position: absolute;z-index: 1001;display: block}
.kch_nav_menu>ul{margin-bottom: 0px;}
.kch_nav_menu ul>li{display: inline}
.kch_nav_menu>ul>li{height: 69px;line-height: 69px;}
.kch_nav_menu a{ color: #111; font-size: 1.25em; padding: 21px 25px; text-decoration: none;}
.kch_nav_menu>ul>li>a:hover{color: #42AF41;border-bottom: 3px solid #42AF41;}
.active>a{color: #42AF41;border-bottom: 3px solid #42AF41;}
.mainMenu{display: none} @media (max-width: 980px) {
.kch_nav_cont{ width: 95%; }
} @media (max-width: 768px) {
.kch_nav_cont{ width: 100%;}
.kch_nav_menu a{ font-size: 1em; padding: 21px 15px;}
} @media (max-width: 550px) {
.kch_nav{height: 55px;}
.kch_nav_cont{ width: 100%; }
.kch_nav_logo>a>img{height: 55px; margin-left: 45px;padding-top: 4px; padding-bottom: 4px;}
.kch_nav_menu ul{padding-left: 0px;}
.kch_nav_menu a{ font-size: 1em; padding: 21px 15px;}
.kch_nav_menu{width: 50%;text-align:center; right:0;top:55px;border: 1px solid #ccc;display: none}
.kch_nav_menu ul>li{display: list-item;list-style: none;border-bottom: 1px solid #ccc;}
.kch_nav_menu>ul>li{background:rgba(1,1,1,0.75);height: 45px;line-height: 45px;}
.kch_nav_menu a{ width:100%;color: #fff; font-size: 1.25em; padding-top: 8px;padding-bottom: 8px; text-decoration: none;}
.kch_nav_menu>ul>li>a:hover{color: #42AF41;border-bottom: 0px solid #42AF41;width: 100%;}
.active>a{color: #42AF41;border-bottom: 0px solid #42AF41;}
.mainMenu{display: block;color: #42AF41;font-size:24px;float: right;width: 40px;height: 40px;border:1px solid #ccc;border-radius: 5px;line-height: 40px;text-align: center; margin-right: 45px; margin-top: 7px;}
}

html代码

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="keywords" content="空车汇">
<meta name="description" content="空车汇是联冠汇通团队致力于物流行业智能化、信息化的研究而推出的移动互联网信息平台。旨在有效整合运力,对接货源,降低空驶率、节约成本、提高效率、增强信誉度,让业务智能、可视、可控,实现多方共赢"> <!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
<title>好运费,就上空车汇</title>
<!-- Bootstrap -->
<link href="assets/css/bootstrap.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="js/html5shiv.min.js"></script>
<script src="js/respond.min.js"></script> <![endif]--> <script src="js/jquery-latest.min.js"></script> </head> <body>
<!--//空车汇导航条--> <div class="kch_nav">
<div class="kch_nav_cont">
<div class="kch_nav_logo">
<a href="#"><img src="data:images/logo.png"/></a>
<a class="mainMenu" id="kchMainMenu"><i class=" glyphicon glyphicon-th-list"></i> </a>
</div>
<div class="kch_nav_menu">
<ul>
<li class="active"><a href="index.html">首页</a></li>
<li><a href="shipper.html">货主</a></li>
<li><a href="driver.html">车主</a></li>
<li><a href="about.html">关于我们</a></li>
<li><a href="properDistribute.html">交易</a></li>
<li><a href="login.html">登陆</a></li>
</ul>
</div>
</div>
</div> <script src="js/bootstrap.min.js"></script>
<script>
var i=1;
$('#kchMainMenu').click(function(){
++i; if(i%2==0){
$('.kch_nav_menu').fadeIn(500);
$(this).css('color','#b6b6b6');
}else{
$('.kch_nav_menu').fadeOut(500);
$(this).css('color','#42AF41');
} }) </script> </body>
</html>

基于Bootstrap、Jquery的自适应导航栏的更多相关文章

  1. 基于Bootstrap+jQuery.validate Form表单验证实践

    基于Bootstrap jQuery.validate Form表单验证实践 项目结构 :     github 上源码地址:https://github.com/starzou/front-end- ...

  2. jquery侧边折叠导航栏制作,两行代码搞定

    jquery侧边折叠导航栏制作,两行代码搞定 //CSS*{margin: 0;padding: 0} ul{list-style: none} .menu li ul{display: none} ...

  3. Bootstrap之响应式导航栏

    代码: <!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8 ...

  4. Bootstrap响应式的导航栏

    Bootstrap 导航栏 | 菜鸟教程 <!DOCTYPE html> <html> <head> <meta charset="utf-8&qu ...

  5. 【1-4】jQuery代码风格-导航栏

    实现一个导航栏,单机不同的商品名称链接,显示相应的内容,同时高亮显示当前选择的商品. 实现功能如图: css: /* reset */ ;padding:0 0 12px 0;font-size:12 ...

  6. Jquery实现动态导航栏和轮播导航栏

    动态导航栏和轮播导航栏的实现思想: 利用jquery技术的append()方法和bind()方法实现li标签的添加和点击事件绑定,在利用$getJSON(url,data,function)请求方法实 ...

  7. HTML5开发移动web应用—JQuery Mobile(2)-导航栏和页脚

    导航栏部分的代码一般放置在data-role为header的div的内. <div data-role="header"> <a href="#&quo ...

  8. JS自适应导航栏,菜单栏

    1. 打开 https://github.com/VPenkov/okayNav下载源代码 2.引入两个css样式 <link rel="stylesheet" href=& ...

  9. jquery版滑块导航栏

    <!DOCTYPE html><html> <head> <meta charset="UTF-8"> <script src ...

随机推荐

  1. WeView 里引用的H5中的文字 到行末尾 文字被切割

    这个情况 在iPhone6以上没问题  以下有问题  具体情况是 我用以下代码计算内容的高度 NSString *injectionJSString = @"var script = doc ...

  2. CodeForces比赛总结表

    Codeforces A                     B                        C                             D            ...

  3. 页面上常用的一些小功能--QQ、回到顶部

    1.QQ <script charset="utf-8" type="text/javascript" src="http://wpa.b.qq ...

  4. iOS 网络监测

    iOS网络监测,监测单个页面写在ViewController里,监测全部写在AppDelegate中,而且不用终止 - (void)viewDidLoad { [super viewDidLoad]; ...

  5. Android 学习第17课,使用文件的数据存储(4种存储模式)

    Context.MODE_PRIVATE:为默认操作模式,代表该文件是私有数据,只能被应用本身访问,在该模式下,写入的内容会覆盖原文件的内容,如果想把新写入的内容追加到原文件中.可以使用Context ...

  6. dis进行反编译

    摘录自官方文档: https://docs.python.org/2/library/dis.html 回头自己也脑补下. 可以使用dis查看自己代码的复杂度之类的东西. 比如while 1 和whi ...

  7. CSS3中:nth-child和:nth-of-type的区别深入理解。 关于:nth-child和:nth-of-type的区别之前一直没太注意,经深入理解才发现里面其实暗藏玄机

    关于:nth-child和:nth-of-type的区别之前一直没太注意.最近打算深入了解一些CSS3,才发现里面其实暗藏玄机. :nth-child可以选择父元素下的字元素,:nth-of-type ...

  8. C++ 类知识点

    1. member function definitions are processed after the compiler processes all of the declarations in ...

  9. 过滤emoji表情

    str=str.replace(/\ud83c[\udf00-\udfff]|\ud83d[\udc00-\ude4f]|\ud83d[\ude80-\udeff]/g, "");

  10. help man info 三个的区别

    “--help”选项 “--help”是一个工具选项,大部分的GNU工具都具备这个选项,“--help”选项可以用来显示一些工具的信息 “man”工具 Man工具可以显示系统手册页中的内容,这些内容大 ...