固定底部导航菜单-续集(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 ...
随机推荐
- git上传本地文件到gitlab
The repository for this project is empty If you already have files you can push them using command l ...
- HDU 4162 Shape Number(字符串,最小表示法)
HDU 4162 题意: 给一个数字串(length <= 300,000),数字由0~7构成,求出一阶差分码,然后输出与该差分码循环同构的最小字典序差分码. 思路: 第一步是将差分码求出:s[ ...
- 大数据学习(6)MapReduce应用
倒排索引 /** * * * <pre> *file1.txt: *hello ketty *hello tomcat * *file2.txt: *hello hadoop * *map ...
- check the manual that corresponds to your MySQL server version for the right syntax处理方案
check the manual that corresponds to your MySQL server version for the right syntax:代码出现这样的bug,就要注意你 ...
- nodejs实现OAuth2.0授权服务
OAuth是一种开发授权的网络标准,全拼为open authorization,即开放式授权,最新的协议版本是2.0. 举个栗子: 有一个"云冲印"的网站,可以将用户储存在Goog ...
- 让你用sublime写出最完美的python代码--windows环境
至少很长一段时间内,我个人用的一直是pycharm,也感觉挺好用的,也没啥大毛病 但是pycharm确实有点笨重,啥功能都有,但是有很多可能这辈子我也不会用到,并且pycharm打开的速度确实不敢恭维 ...
- Jenkins in OpenCASCADE
Jenkins in OpenCASCADE eryar@163.com Abstract. Jenkins是一个开源软件项目,是基于Java开发的一个持续集成工具,用于监控持续复制的工作,旨在提供一 ...
- Laravel学习笔记(一)
根据国外的调查,Laravel是最流行的框架,最近公司需要PHP的开发人员,但是一直招不到人,只好亲自上阵研究一下.由于以前对PHP只是大致了解,这次学习开始的时候也挺挠头的,到今天稍微入了 ...
- 【java】io流之字节流转为字符流:java.io.OutputStreamWriter和java.io.InputStreamReader
package 文件操作; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; impo ...
- iOS App稳定性指标及监测
一个App的稳定性,主要决定于整体的系统架构设计,同时也不可忽略编程的细节,正所谓"千里之堤,溃于蚁穴",一旦考虑不周,看似无关紧要的代码片段可能会带来整体软件系统的崩溃.尤其因为 ...