利用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定义一个导航条菜单的更多相关文章

  1. jQuery Mobile 自定义导航条图标

    1.jQuery Mobile 自定义导航条图标

  2. css制作漂亮彩带导航条菜单

    点击这里查看效果:http://keleyi.com/keleyi/phtml/divcss/17.htm 效果图: 以下是源代码: <!DOCTYPE html PUBLIC "-/ ...

  3. 分享一个导航条哈(⊙o⊙)…

    原文:http://www.sharejs.com/js/menu/1601 CSS样式表: <!--[if lt IE 9]> <script src="http://h ...

  4. js 或jquery定义方法时,参数不固定是怎么实现的

    //①不定义接受参数的方式来接受参数(arguments) function getparams(){ //利用arguments来接受参数,arguments表示参数集合, //里面存放的调用这个方 ...

  5. 关于CSS样式的那些事_导航条菜单讲解

    最近开始忙着开自己的个人博客了,自己的前端确实是渣渣.没办法,一步步来,从慕课网上慢慢学着先. 首先带来的是一个导航栏的设计: 垂直导航栏的设计: 直接上代码: <!DOCTYPE html P ...

  6. JQuery Mobile+JS实现智能浮动定位导航条

    实现原理 主要用到几个知识点: 什么是scrollTop? CSS position定位 判断是否为IE6浏览器 元素相对于窗口的距离 原理:1,浏览器向下滚动时,当document的scrollTo ...

  7. 利用JS跨域做一个简单的页面访问统计系统

    其实在大部分互联网web产品中,我们通常会用百度统计或者谷歌统计分析系统,通过在程序中引入特定的JS脚本,然后便可以在这些统计系统中看到自己网站页面具体的访问情况.但是有些时候,由于一些特殊情况,我们 ...

  8. 利用JS跨域做一个简单的页面訪问统计系统

    事实上在大部分互联网web产品中,我们一般会用百度统计或者谷歌统计分析系统,通过在程序中引入特定的JS脚本,然后便能够在这些统计系统中看到自己站点页面详细的訪问情况.可是有些时候,因为一些特殊情况,我 ...

  9. 一、HTML和CSS基础--网页布局--实践--导航条菜单的制作

    案例一:导航菜单的制作 垂直菜单

随机推荐

  1. maven and jwt

    以目前浅薄的理解,jwt就是一种加密token的手段,这个token也只有自己能解开,如果客户端以cookie存这个token,可能会存在cookie被窃取的情况. 另外,jwt这中加密方式因为有过期 ...

  2. winscp的root连接ubuntu“拒绝访问”的解决方法

    转载:https://www.cnblogs.com/weizhxa/p/10098640.html 解决: 1.修改ssh配置文件:sudo vim etc/ssh/sshd_config 在#Pe ...

  3. bootstarpTable load data

    <!doctype html> <html lang="en"> <head> <!-- Required meta tags --> ...

  4. docker应用-6(mysql+mycat 搭建数据库集群)

    上一节,通过使用overlay网络,搭建了跨主机的docker容器集群.下面,在这个跨主机的docker容器集群环境下,搭建mysql 数据库集群. mysql主从自动备份和自动切换 从数据安全性考虑 ...

  5. GitLab push除发Jenkins事件

    1.打开Jenkins项目配置 2.勾选Trigger builds remotely (e.g., from scripts) 3.Authentication Token随便填个内容(比方1234 ...

  6. linux/nginx命令

    1.ps查看服务器所有的进程: -aux 显示所有状态 -ef 简洁信息 ps -aux | grep node 第二列是pid,杀掉程序使用kill. ps -ef | grep node 第一列是 ...

  7. Spark连接MongoDB之Scala

    MongoDB Connector for Spark Spark Connector Scala Guide spark-shell --jars "mongo-spark-connect ...

  8. B - Battle City bfs+优先队列

    来源poj2312 Many of us had played the game "Battle city" in our childhood, and some people ( ...

  9. electron+react

    yarn create react-app electron-react cd electron-react yarn run eject // 修改react-app打包的路径 / -> ./ ...

  10. 把html页面转化成图片——html2canvas

    test.html <div class="fx_zhezhao"></div> <div class="myImg"> & ...