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在标题栏弹出菜单的方法
转载请说明原出处,谢谢~~ 上篇日志说明了怎么让自定义控件响应右键消息.之后我给主窗体的标题栏增加右键响应,观察原酷狗后可以发现,在整个标题栏都是可以响应右键并弹出菜单的.应该的效果如下: 本以为像上 ...
随机推荐
- 解决vue变量未渲染前代码显示问题
在网络加载缓慢或者刷新的时候总会有那么一瞬间出现vue的模板代码,实在很影响美观,对于我这种有强迫症的人来说实在是忍无可忍,后来经过查找资料,终于发现了解决方法,可以使用vue现成的指令来解决这个问题 ...
- 『C++』Temp_2018_12_13 函数指针
#include <iostream> #include <string> using namespace std; class Test{ private: string n ...
- Dubbo 改造普通单体项目
一.新建普通maven项目 1.首先,新建3个普通maven商城项目,模拟以往常见的Java单体应用开发,mall-interface是存放接口和公共代码部分,order-service-consum ...
- 转:Java并发集合
引自:http://ifeve.com/concurrent-collections-1/ 并发集合(一)引言 声明:本文是< Java 7 Concurrency Cookbook>的第 ...
- 阿里云Windows远程连接出现身份验证错误,要求的函数不正确”的报错。
最近很多阿里云用户在远程Windows Server的云服务器ECS时出现“身份验证错误,要求的函数不受支持”的报错. 这个问题解决起来非常简单,修改组策略中的一个配置就可以了. 在运行中输入gped ...
- 『Python题库 - 简答题』 Python中的基本概念 (121道)
## 『Python题库 - 简答题』 Python中的基本概念 1. Python和Java.PHP.C.C#.C++等其他语言的对比? 2. 简述解释型和编译型编程语言? 3. 代码中要修改不可变 ...
- for循环练习题(1 ,判断任意一个数是91的多少倍 2,编写程序实现给定一个整数判断它从0到这个整数中间出现多少次9的次数)
1 //判断任意一个数是9的多少倍 #include <stdio.h> #include <stdlib.h> int main() { printf("请输入任意 ...
- C语言实现左旋字符串
#include<stdio.h> #include<stdlib.h> #include<string.h> void left_rotate(char *str ...
- 推荐 的FPGA设计经验(2)-时钟策略优化
Optimizing Clocking Schemes Avoid using internally generated clocks (other than PLLs) wherever possi ...
- [Real World Haskell翻译]第23章 GUI编程使用gtk2hs
第23章 GUI编程使用gtk2hs 在本书中,我们一直在开发简单的基于文本的工具.虽然这些往往是理想的接口,但有时图形用户界面(GUI)是必需的.有几个Haskell的GUI工具包是可用的.在本章中 ...