固定底部导航菜单-续集(BottomMenu-移动端V3.0)
固定底部导航菜单-续集(BottomMenu-移动端V3.0)

适应在客户端,点击弹出二级菜单。因为手机不支持hover.所以使用click点击实现弹出菜单,并且一级菜单聚焦变色,变化背景图片
核心css片段
====================
根据css3伪类元素:before实现
在根据/*A.active.tab:befre就是说同时有这两个class的A标签的before伪元素*/
.bottommenu li>a.active{
color: #318BE3;
}
.bottommenu .tab:before {
content: '';
display: block;
width: 42px;
height: 42px;
margin: 0 auto;
background: url(../images/icon.png) no-repeat;
background-size: 42px;
}
.bottommenu .homeI_zhuye:before {
background-position: 1px -83px;
}
/*A.active.tab:befre就是说同时有这两个class的A标签的before伪元素*/
.bottommenu li>a.active.homeI_zhuye:before {
background-position: 0px -366px;
}
.bottommenu .homeI_dingdan:before {
background-position: 1px 4px;
}
.bottommenu li>a.active.homeI_dingdan:before {
background-position: 1px -474px;
}
.bottommenu .homeI_chanpin:before {
background-position: -1px -168px;
}
.bottommenu li>a.active.homeI_chanpin:before {
background-position: -1px -572px;
}
.bottommenu .homeI_yonghu:before {
background-position: 0px -259px;
}
.bottommenu li>a.active.homeI_yonghu:before {
background-position: 1px -672px;
}
=====================
核心js代码
$(".bottommenu li .tab").click(function() {
$(".bottommenu li .tab").removeClass('active');
$(this).addClass("active");
});
});
==============HTML=============
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en">
<html>
<head>
<title>bottommenu底部导航菜单-移动端 </title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="author" content="">
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0"/>
<link href="css/base.css" type="text/css" rel="stylesheet" />
<link href="css/bottommenu.css" type="text/css" rel="stylesheet" />
<script language="javascript" type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script language="javascript" type="text/javascript" src="js/pop-layer.js"></script>
</head>
<body>
<div class="bottom">
<ul class="bottommenu">
<li><a href="#" class="homeI_zhuye tab">首页</a>
<ul class="pop-layer">
<li><a href="#" class="">弹出层1</a></li>
<li><a href="javascript:void(0);" class="">弹出层2</a></li>
<li><a href="javascript:void(0);" class="">弹出层3</a></li>
</ul>
</li>
<li><a href="javascript:void(0);" class="homeI_dingdan tab">订单</a></li>
<li><a href="javascript:void(0);" class="homeI_chanpin tab">产品</a>
<ul class="pop-layer">
<li><a href="javascript:void(0);" class="">弹出层1</a></li>
<li><a href="javascript:void(0);" class="">弹出层2</a></li>
<li><a href="javascript:void(0)" class="">弹出层3</a></li>
<li><a href="javascript:void(0);" class="">弹出层4</a></li>
<li><a href="javascript:void(0)" class="">弹出层5</a></li>
</ul>
</li>
<li><a href="javascript:void(0);" class="homeI_yonghu tab">我的</a></li>
</ul>
</div>
</body>
</html>
====================CSS===========================
.bottom {
width: 100%;
height: 90px;
line-height: 90px;
position: fixed;
bottom: 0;
left: 0;
background: #FFFFFF;
}
.bottom li {
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}
.bottom .bottommenu {
height: 90px;
border-top: 1px #dedede solid;
background: #F3F3F3;
}
.bottom .bottommenu>li {
float: left;
width: 25%;
height: 90px;
text-align: center;
position: relative;
padding-top: 10px;
}
.bottom .bottommenu>li+li {
border-left: 1px #dedede solid;
}
.bottommenu li>a {
color: #4f4d4f;
font-size: 16px;
display: block;
line-height: 32px;
padding-top: 4px;
}
.bottommenu .pop-layer {
/*visibility: hidden;*/
display: none;
text-align: center;
border-top: 1px #dedede solid;
background: #FFFFFF;
border-left: 1px #FFFFFF solid;
border-right: 1px #FFFFFF solid;
position: absolute;
bottom: 91px;
width: 100%;
/* -moz-box-shadow: 3px 3px 4px #333232;
-webkit-box-shadow: 2px 1px 2px #F1F1F1
box-shadow: 2px 1px 2px #F1F1F1;*/
}
.pop-layer li+li {
height: 50px;
border-top: 1px #dedede solid;
}
.pop-layer li a {
padding-top: 0;
height: 50px;
line-height: 50px;
}
.triangle-bottomleft {
width: 0;
height: 0;
border-bottom: 10px solid #dedede;
border-left: 10px solid transparent;
position: absolute;
right: 7px;
bottom: 7px;
}
.bottommenu li>a.active{
color: #318BE3;
}
.bottommenu .tab:before {
content: '';
display: block;
width: 42px;
height: 42px;
margin: 0 auto;
background: url(../images/icon.png) no-repeat;
background-size: 42px;
}
.bottommenu .homeI_zhuye:before {
background-position: 1px -83px;
}
/*A.active.tab:befre就是说同时有这两个class的A标签的before伪元素*/
.bottommenu li>a.active.homeI_zhuye:before {
background-position: 0px -366px;
}
.bottommenu .homeI_dingdan:before {
background-position: 1px 4px;
}
.bottommenu li>a.active.homeI_dingdan:before {
background-position: 1px -474px;
}
.bottommenu .homeI_chanpin:before {
background-position: -1px -168px;
}
.bottommenu li>a.active.homeI_chanpin:before {
background-position: -1px -572px;
}
.bottommenu .homeI_yonghu:before {
background-position: 0px -259px;
}
.bottommenu li>a.active.homeI_yonghu:before {
background-position: 1px -672px;
}
=====================JS=========================
$(document).ready(function() {
$(".bottommenu li").click(function(e) {
if ($(this).find(".pop-layer").is(':hidden')) {
$(".bottommenu li .pop-layer").hide();
$(this).find(".pop-layer").show();
} else {
$(".bottommenu li .pop-layer").hide();
}
e.stopPropagation(); // 阻止冒泡
});
$(".pop-layer li").click(function(e) {
$(".pop-layer li").css('background', '#fff');
$(this).css('background', '#f0f0f0');
$(this).parent().show();
e.stopPropagation(); // 阻止冒泡
});
$(document).click(function() { // 点击空白消失
$(".bottommenu li .pop-layer").hide();
});
$(".bottommenu li .tab").click(function() {
$(".bottommenu li .tab").removeClass('active');
$(this).addClass("active");
});
});
=====================
感谢华-一棵树思维
下载地址:http://files.cnblogs.com/files/leshao/BottomMenu-%E7%A7%BB%E5%8A%A8%E7%AB%AFV3.0.rar
固定底部导航菜单-续集(BottomMenu-移动端V3.0)的更多相关文章
- bootstrap 固定底部导航自适应
在使用bootstrap 底部导航的时候遇到了一个问题 -- 当我的内容超过一屏的时候,底部的部分内容会被固定的导航内容遮盖 自己写了一个JS脚本,解决自适应的问题 <nav class=&qu ...
- Bootstrap 固定底部导航栏菜单
直接上代码: <!DOCTYPE html> <html> <head> <meta http-equiv="content-type" ...
- 第01章 开发准备(对最新版的RN进行了升级)1-4 项目底部导航菜单开发
- Flutter - 创建底部导航栏
之前写过的一篇文章介绍了 Flutter - 创建横跨所有页面的侧滑菜单, 这次就一起来学习一下底部导航栏. 底部导航栏在ios平台上非常常见,app store就是这样的风格.还有就是大家最常用的微 ...
- 底部导航栏-----FragmentTabHost
[说明] 1.主界面上添加父容器:FragmentTabHost 属于v4兼容包 需要指定该id为android:id/tabhost,不能修改,表示由android系统来托管这个id. 本身是一个F ...
- 解决 scroll() position:fixed 抖动、导航菜单固定头部(底部)跟随屏幕滚动
一.导航栏或者页脚正常情况下固定在页面的相应位置,当页面滚动后,导航栏或者页脚固定在页面的顶部或者底部的情景 一般就是将该块的代码样式的position设置为fixed.固定在顶部的话,将top设置为 ...
- 移动端可拖动导航菜单小demo
<!DOCTYPE html> <html lang="en"> <head> <title>移动端滑动导航菜单</title ...
- h5移动端常见虚拟键盘顶起底部导航栏解决办法
在h5移动端开发中相信很多朋友跟我一样都会遇到页面底部导航被虚拟键盘顶起的问题,自己在网上找到的解决办法拿出来与大家分享,有不完美之处还望见谅,有更好的解决办法可以贴出来大家一起互相学习!! var ...
- uni-app h5端跳转到底部导航栏的时候使用方法uni.switchTab跳转刷新页面更新数据
h5端的uni-app项目 需求:uni-app h5端跳转到底部导航栏的时候使用方法uni.switchTab跳转刷新页面更新数据 百度的方法如下: uni.switchTab({ url: '/p ...
随机推荐
- ansible批量管理软件部署及剧本
服务器版本信息: Centos6.9 [root@db02 ~]# uname -a Linux db02 -.el6.x86_64 # SMP Tue Mar :: UTC x86_64 x86_6 ...
- SpringBoot 整合Ehcache3
SpringBootLean 是对springboot学习与研究项目,是依据实际项目的形式对进行配置与处理,欢迎star与fork. [oschina 地址] http://git.oschina.n ...
- HDU 1013.Digital Roots【模拟或数论】【8月16】
Digital Roots Problem Description The digital root of a positive integer is found by summing the dig ...
- Eclipse的Servers视图中无法加入Tomcat6/Tomcat7
引言: 在基于Eclipse的开发过程中,出现了无法在Eclipse中加入Tomcat的问题,经过从网上搜索之后.找到了答案. 问题的提出: 无法从下面方式,加入Tomcatserver. 当中Se ...
- MySql基础总结
1.创建一个表 CREATE TABLE customers ( cust_id INT NOT NULL AUTO_INCREMENT, cust_name CHAR(50) NOT NULL , ...
- day02-多线程之线程安全
/** * 线程安全概念:当多个线程访问某一个类(对象或方法)时,这个对象始终都能表现出正确的行为,那么这个类(对象或方法)就是线程安全的. * synchronized:可以在任意对象及方法上加锁, ...
- [原创]mysql的zip包如何在windows下安装
今天在尝试zipkin的链路数据写入mysql,本机恰好没有按照mysql.找到一个很久前谁发的mysql-5.6.19-winx64.zip,版本不新?别挑剔啦,只是本机测试,能用就好哈哈.. 解压 ...
- 《C程序设计语言》【PDF】下载链接:
<C程序设计语言>[PDF]下载 https://u253469.pipipan.com/fs/253469-230382180 内容简介 在计算机发展的历史上,没有哪一种程序设计语言像C ...
- Redis4.0.0 安装及配置 (Linux — Centos7)
本文中的两个配置文件可在这里找到 操作系统:Linux Linux发行版:Centos7 安装 下载地址,点这里Redis4.0.0.tar.gz 或者使用命令: wget http://downlo ...
- iOS 环信集成项目应用
环信iOS端3.0版本集成记录--聊天界面篇 环信离线推送证书... 1,环信处在后台的时候,消息的接收与推送 离线发推送 配置属性 EMCallOptions *options = [[EMClie ...