css模仿微信弹出菜单
css模仿微信弹出菜单
效果图:
html:
<div class="action-sheet-backdrop">
<div class="action-sheet-wrapper">
<div class="action-sheet">
<div class="action-sheet-group action-sheet-options">
<div class="action-sheet-title">选择</div>
<button class="button action-sheet-option ">未婚</button>
<button class="button action-sheet-option ">已婚</button>
</div>
<div class="action-sheet-group action-sheet-cancel">
<button class="button">取消</button>
</div>
</div>
</div>
</div>
css:
.action-sheet-backdrop {
-webkit-transition: background-color 150ms ease-in-out;
transition: background-color 150ms ease-in-out;
position: fixed;
top: 0;
left: 0;
z-index: 11;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0); } .action-sheet-backdrop.active {
background-color: rgba(0, 0, 0, 0.4); } .action-sheet-wrapper {
-webkit-transform: translate3d(0, 100%, 0);
transform: translate3d(0, 100%, 0);
-webkit-transition: all cubic-bezier(0.36, 0.66, 0.04, 1) 500ms;
transition: all cubic-bezier(0.36, 0.66, 0.04, 1) 500ms;
position: absolute;
bottom: 0;
left: 0;
right: 0;
width: 100%;
max-width: 500px;
margin: auto;
} .action-sheet-up {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
} .action-sheet {
margin-left: 8px;
margin-right: 8px;
width: auto;
z-index: 11;
overflow: hidden;
} .action-sheet .button {
display: block;
padding: 1px;
width: 100%;
border-radius: 0;
border-color: #d1d3d6;
background-color: transparent;
color: #007aff;
font-size: 21px;
} .action-sheet .button:hover {
color: #007aff;
} .action-sheet .button.destructive {
color: #ff3b30;
} .action-sheet .button.destructive:hover {
color: #ff3b30;
} .action-sheet .button.active, .action-sheet .button.activated {
box-shadow: none;
border-color: #d1d3d6;
color: #007aff;
background: #e4e5e7;
} .action-sheet-has-icons .icon {
position: absolute;
left: 16px;
} .action-sheet-title {
padding: 16px;
color: #8f8f8f;
text-align: center;
font-size: 13px;
} .action-sheet-group {
margin-bottom: 8px;
border-radius: 4px;
background-color: #fff;
overflow: hidden;
} .action-sheet-group .button {
border-width: 1px 0px 0px 0px;
} .action-sheet-group .button:first-child:last-child {
border-width: 0;
} .action-sheet-options {
background: #f1f2f3;
max-height: 520px;
overflow-y: auto;
} .action-sheet-cancel .button {
font-weight: 500;
} .action-sheet-open {
pointer-events: none;
} .action-sheet-open.modal-open .modal {
pointer-events: none;
} .action-sheet-open .action-sheet-backdrop {
pointer-events: auto;
z-index: 1111;
} .action-sheet .action-sheet-title, .platform-android .action-sheet .button {
text-align: center;
} .action-sheet-cancel {
display: block;
}
只需要js控制切换class名。
$("body").click(function(){
$("body").addClass("action-sheet-open");
$(".action-sheet-backdrop").addClass("active");
$(".action-sheet-wrapper").addClass("action-sheet-up")
})
$(".button").click(function(event){
$("body").removeClass("action-sheet-open");
$(".action-sheet-backdrop").removeClass("active");
$(".action-sheet-wrapper").removeClass("action-sheet-up")
event.stopPropagation( );
})
最终的效果图为:
css模仿微信弹出菜单的更多相关文章
- 纯div+css制作的弹出菜单
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- DIV+CSS制作二级横向弹出菜单,略简单
没有使用JavaScript控制二级菜单的显示,结果如上图所示. 代码如下: <!DOCTYPE html> <html> <head> <meta char ...
- 布局分析002:入门级的CSS导航弹出菜单
这种弹出菜单非常有意思,也有记录的意义,甚至可以说,掌握了这种弹出菜单,基本上CSS掌握的差不多. 主要涉及下面三个重要知识: CSS的继承性质. relative absolute定位. 子选择符& ...
- css+html+js实现多级下拉和弹出菜单
本文将使用css+html+js实现横向菜单.具有多级弹出菜单下拉. 首先我们来看看效果图: watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvajkwMzgy ...
- HTML5微信长按图片不会弹出菜单的解决方法
HTML5微信长按图片不会弹出菜单的解决方法 <pre><div ontouchstart = "return false;"></div>&l ...
- 向上弹出菜单jQuery插件
插件名:柯乐义英文名:Keleyijs文件名称:jquery.keleyi.js插件功能:该插件可以让你轻易地在页面上构建一个向上弹出的二级菜单. 示例查看:http://keleyi.com/kel ...
- html5手机端遮罩弹出菜单代码
效果体验:http://hovertree.com/texiao/html5/17/ 效果图: 代码如下: <!doctype html> <html lang="zh&q ...
- html + js 右 点击 弹出 菜单
页面 引用jar 包 <link rel="stylesheet" href="../../style/zui.min.css" type="t ...
- 仿酷狗音乐播放器开发日志二十六 duilib在标题栏弹出菜单的方法
转载请说明原出处,谢谢~~ 上篇日志说明了怎么让自定义控件响应右键消息.之后我给主窗体的标题栏增加右键响应,观察原酷狗后可以发现,在整个标题栏都是可以响应右键并弹出菜单的.应该的效果如下: 本以为像上 ...
随机推荐
- CF1066EBinary Numbers AND Sum(前缀和,二进制)
题目大意 现在,给你两个位数为 n 和 m 的两个二进制数a,b,现在,我们要进行如下操作: 计算a&b 答案累加上一个操作的值 bbb右移一位,最后一位直接舍弃 现在,请你算出最终的答案,并 ...
- STL笔记
STL的基本概念: 1-容器:是可容纳各种类型的数据结构,是 类模板. 2-迭代器:是用于依次存放容器中的元素,类似指针. 3-算法: 是用于操作容器中元素的 函数模板. sort() 用来对 vec ...
- mac appstore应用下载失败,不能更新等等问题,都可以解决
打开终端,输入以下命令 open `getconf DARWIN_USER_CACHE_DIR`/com.apple.appstore 进入目录,删除 com.apple.appstore  重启系 ...
- 浅析MySQL主从复制技术(异步复制、同步复制、半同步复制)
Preface As we all know,there're three kinds of replication in MySQL nowadays.Such as,asynchr ...
- 【JavaWeb】从零实现用户登录
1.数据库预备 1.1 SQL 创建数据库 create database db; 创建表 create table userInfo( id int primary key , name ), pa ...
- C#的哈希表Hashtable同步方法
在多线程环境的操作中对Hashtable进行操作需要进行同步控制,有两种方法,一种是由.Net自动控制:一种是在代码中自己控制. 1.使用Hashtable.Synchronized进行同步 Hash ...
- python爬虫#数据存储#JSON/CSV/MYSQL/MongoDB/
Json数据处理 JSON支持数据格式: 对象(字典).使用花括号. 数组(列表).使用方括号. 整形.浮点型.布尔类型还有null类型. 字符串类型(字符串必须要用双引号,不能用单引号). 多个数据 ...
- IA64与x86-64的区别
win7 sp1下载地址:https://download.microsoft.com/download/0/A/F/0AFB5316-3062-494A-AB78-7FB0D4461357/wind ...
- FPGA学习之路——PLL的使用
锁相环(PLL)主要用于频率综合,使用一个 PLL 可以从一个输入时钟信号生成多个时钟信号. PLL 内部的功能框图如下图所示: 在ISE中新建一个PLL的IP核,设置四个输出时钟,分别为25MHz. ...
- c#调用c++库函数
如果是非托管的,就用DllImport,举例 using System; using System.Runtime.InteropServices; class MainApp ...