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. SQlServer第一天

    SQLserver是个什么东西?相当于一是个货仓,在计算机领域的货仓,学名:数据库. 数据库是个什么东西呢?是指长期存储在计算机内的.有组织.可共享的数据结合.由此可知数据库的三个特点:永久存储.有组 ...

  2. Cannot forward after response has been committed

    项目:蒙文词语检索 日期:2016-05-01 提示:Cannot forward after response has been committed 出处:request.getRequestDis ...

  3. 安装XAMPP后APACHE不能启动解决方法

    自己的xampp中的apache启动失败,在网上找到了一篇文章,感觉不错,原文如下: Xampp的获得和安装都十分简单,你只要到以下网址: http://www.apachefriends.org/z ...

  4. ios--个人资料修改

    点击进行编辑  (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *) ...

  5. web api 初体验 解决js调用跨域问题

    跨域界定 常见跨域: 同IP不同端口: http:IP:8001/api/user     http:IP:8002/api/user 不同IP不同端口: http://172.28.20.100:8 ...

  6. C# 属性控件的应用(备忘)

    自己定义的控件属性:[Browsable(true),Bindable(true),Category("数据"),DefaultValue(""),Locali ...

  7. php语言的几种循环语句的使用格式,及其区别

    while 只要指定的条件成立,则循环执行代码块 do...while 首先执行一次代码块,然后在指定的条件成立时重复这个循环 for 循环执行代码块指定的次数 foreach 根据数组中每个元素来循 ...

  8. iOS Block循环引用

    在介绍block循环引用前我们先了解一下typeof. typeof是什么??? typeof 是一个一元运算,放在一个运算数之前,运算数可以是任意类型. 它返回值是一个字符串,该字符串说明运算数的类 ...

  9. .net 如何引用迅雷组件

    本文记录两个部分,本人自己引用迅雷组件的经历和引用迅雷组件相关原理 the first: 添加引用 -> COM -> ThunderAgent 1.0 Type Library(前提是已 ...

  10. RealProxy实现AOP编程(2)

    稍微变化一下!注意区别. Program.cs class Program { static void Main(string[] args) { User user = " }; var ...