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. 【LeetCode】Roman to Integer & Integer to Roman

    Roman to Integer Given a roman numeral, convert it to an integer. Input is guaranteed to be within t ...

  2. Maven生命周期

    Maven的生命周期抽象了构建的各个步骤,定义了他们的次序,但没有提供实现.Maven设计了插件机制.每个构建步骤都可以绑定一个或多个插件行为,而且Maven为大多数构建步骤编写并绑定了默认插件. M ...

  3. Vector Calculus

    Vector Fields Vector Function F(x,y,...)=P(x,y)i + Q(x,y)j + ... = <P(x,y), Q(x,y), ...> F=Pi ...

  4. 通过HttpWebRequest请求与HttpWebResponse响应方式发布接口与访问接口

    一.API接口的编码 1.首页的页面代码: protected void Page_Load(object sender, EventArgs e) { /* * 请求路径:http://xxxx/i ...

  5. 用python+selenium抓取知乎今日最热和本月最热的前三个问题及每个问题的首个回答并保存至html文件

    抓取知乎今日最热和本月最热的前三个问题及每个问题的首个回答,保存至html文件,该html文件的文件名应该是20160228_zhihu_today_hot.html,也就是日期+zhihu_toda ...

  6. 《深入浅出Node.js》第5章 内存控制(未完)

    @by Ruth92(转载请注明出处) 第5章 内存控制 基于无阻塞.事件驱动建立的 Node 服务,具有内存消耗低的优点,非常适合处理海量的网络请求. 内存控制正是在海量请求和长时间运行的前提下进行 ...

  7. github中redme添加图片

    README文件后缀名为md.md是markdown的缩写,markdown是一种编辑博客的语言.格式如下: ![](img_url) 即 叹号! + 方括号[ ] + 括号( ) 其中叹号里是图片的 ...

  8. Windows Server 2012 没有远程桌面授权服务器可以提供许可证,远程会话被中断

    今天在登录公司内部的服务器的时候,无法进行远程访问. 弹出错误信息:没有远程桌面授权服务器可以提供许可证,远程会话被中断 经过网上的寻找,原来是server 2012 远程登录只提供120天的使用期限 ...

  9. 二叉树[C实现]

    #include<stdio.h> #include<malloc.h> #include<iostream> //定义节点 typedef struct BiNo ...

  10. 前端开发薪资之各地区对比(图文分析)(share)

    发现最近大家都在关注有关前端开发的薪资问题,不同地方各有差异,今天我就总结一下发出来方便大家的查阅.(2014年) 前面给大家介绍了关于前端开发需要学习的东西,根据你掌握的技能程度,薪水是不一样的.d ...