利用js和JQuery定义一个导航条菜单
利用js和JQuery定义一个导航条
效果:

一、html代码:
<div class="Maintenance">
<div class="Title">
<div class="M_Button" id="Plan">menu1</div>
<div class="M_Button" id="Expert">menu2</div>
<div class="M_Button" id="Team">menu3</div>
<div class="M_Button" id="Medic">menu4</div>
<div class="M_Button" id="Shelter">menu5</div>
<div class="M_Button" id="Warehouse">menu6</div>
</div>
</div>
<!-- menu1 -->
<div class="Content" id="coPlan">
</div>
<!-- menu2 -->
<div class="Content" id="coExpert" style="display: none">
</div>
<!-- menu3 -->
<div class="Content" id="coTeam" style="display: none">
</div>
<!-- menu4-->
<div class="Content" id="coMedic" style="display: none">
</div>
<!--menu5-->
<div class="Content" id="coShelter" style="display: none">
</div>
</div>
<!-- menu6 -->
<div class="Content" id="coWarehouse" style="display: none">
</div>
二、js代码
$(".M_Button").click(function () {
$(".M_Button").removeClass("M_Button_inner");
$(this).addClass("M_Button_inner");
$(".Content").hide();
TabButton = $(this).attr('id');
$('#co' + TabButton).css('display', 'block');
});
三、css代码
.M_Button {
float: left;
height: 42px;
width: 98px;
cursor: pointer;
line-height: 42px;
color: #FFFFFF;
text-align: center;
font-size: 14px;
background-image: url(../../images/emergency/ReffectRadius/The_pop-up_1.png);
background-repeat: no-repeat;
background-position: right;
}
.M_Button:hover {
color: #000;
background-image: url(../../images/emergency/ReffectRadius/The_pop-up_2.png);
background-repeat: repeat-x;
}
.M_Button_inner {
color: #000;
background-image: url(../../images/emergency/ReffectRadius/The_pop-up_2.png);
background-repeat: repeat-x;
}
.Content {
float: left;
height: 438px;
width: 100%;
/*background-image: url(../../../../images/Inspection/Hidden_danger/background.png);*/
}
.M_Content {
height: 434px;
width: 100%;
z-index:;
position: absolute;
/*background-color: #666;*/
right: 2px;
top: 0px;
}
仅供参考,有意见保留!
利用js和JQuery定义一个导航条菜单的更多相关文章
- jQuery Mobile 自定义导航条图标
1.jQuery Mobile 自定义导航条图标
- css制作漂亮彩带导航条菜单
点击这里查看效果:http://keleyi.com/keleyi/phtml/divcss/17.htm 效果图: 以下是源代码: <!DOCTYPE html PUBLIC "-/ ...
- 分享一个导航条哈(⊙o⊙)…
原文:http://www.sharejs.com/js/menu/1601 CSS样式表: <!--[if lt IE 9]> <script src="http://h ...
- js 或jquery定义方法时,参数不固定是怎么实现的
//①不定义接受参数的方式来接受参数(arguments) function getparams(){ //利用arguments来接受参数,arguments表示参数集合, //里面存放的调用这个方 ...
- 关于CSS样式的那些事_导航条菜单讲解
最近开始忙着开自己的个人博客了,自己的前端确实是渣渣.没办法,一步步来,从慕课网上慢慢学着先. 首先带来的是一个导航栏的设计: 垂直导航栏的设计: 直接上代码: <!DOCTYPE html P ...
- JQuery Mobile+JS实现智能浮动定位导航条
实现原理 主要用到几个知识点: 什么是scrollTop? CSS position定位 判断是否为IE6浏览器 元素相对于窗口的距离 原理:1,浏览器向下滚动时,当document的scrollTo ...
- 利用JS跨域做一个简单的页面访问统计系统
其实在大部分互联网web产品中,我们通常会用百度统计或者谷歌统计分析系统,通过在程序中引入特定的JS脚本,然后便可以在这些统计系统中看到自己网站页面具体的访问情况.但是有些时候,由于一些特殊情况,我们 ...
- 利用JS跨域做一个简单的页面訪问统计系统
事实上在大部分互联网web产品中,我们一般会用百度统计或者谷歌统计分析系统,通过在程序中引入特定的JS脚本,然后便能够在这些统计系统中看到自己站点页面详细的訪问情况.可是有些时候,因为一些特殊情况,我 ...
- 一、HTML和CSS基础--网页布局--实践--导航条菜单的制作
案例一:导航菜单的制作 垂直菜单
随机推荐
- Centos&Redhat下bcm43142博通无线网卡linux驱动之二
上次通过更换内核实现成功编译驱动无线网卡,但是启动到系统原内核下依然没有bcm43142的驱动,遂准备在原内核下编译驱动,记录一下 ps:更推荐这种方法,避免因更换内核出现其他兼容性问题 1.准备驱动 ...
- 理解和解决Java并发修改异常ConcurrentModificationException(转载)
原文地址:https://www.jianshu.com/p/f3f6b12330c1 理解和解决Java并发修改异常ConcurrentModificationException 不知读者在Java ...
- Scala学习笔记(七):Rational、隐式转换、偏函数、闭包、重复参数及柯里化
class Rational(n: Int, d: Int) { require(d != 0) private val g: Int = gcd(n, d) val number: Int = n ...
- Idea2018旗舰版破解方法
完整请参考 https://www.jianshu.com/p/3c87487e7121 1.在hosts文件里添加一行: 0.0.0.0 account.jetbrains.com 2.在Activ ...
- linux 安装svn客户端
安装命令:yum install -y subversion 客户端使用命令: svn help 帮助命令 svn checkout --help 子帮助命令
- Linux下">/dev/null 2>&1 "相关知识说明
在学习Linux的过程中,常会看到一些终端命令或者程序中有">/dev/null 2>&1"出现,由于已经遇到了好几次了,为了理解清楚,不妨花点时间百度或者go ...
- page load时执行JavaScript
// Multiple onload function created by: Simon Willison // http://simonwillison.net/2004/May/26/addLo ...
- Linux 依据关键字查找正在运行的进程
ps aux |grep tm1s
- 【MyBatis学习06】_parameter:解决There is no getter for property named in class java.lang.String
我们知道在mybatis的映射中传参数,只能传入一个.通过#{参数名} 即可获取传入的值. Mapper接口文件: public int delete(int id) throws Exception ...
- Oracle RAC环境下ASM磁盘组扩容
生产环境注意调整以下参数: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...