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在标题栏弹出菜单的方法
转载请说明原出处,谢谢~~ 上篇日志说明了怎么让自定义控件响应右键消息.之后我给主窗体的标题栏增加右键响应,观察原酷狗后可以发现,在整个标题栏都是可以响应右键并弹出菜单的.应该的效果如下: 本以为像上 ...
随机推荐
- dataTable学习心得
1.引用文件 <link rel="stylesheet" href="https://cdn.datatables.net/1.10.16/css/jquery. ...
- 『ACM C++』 Codeforces | 1003C - Intense Heat
今日兴趣新闻: NASA 研制最强推进器,加速度可达每秒 40 公里,飞火星全靠它 链接:https://mbd.baidu.com/newspage/data/landingsuper?contex ...
- jsp页面通过EL表达式获取list大小兼容性处理
1.jsp页面通过EL表达式获取list大小,中间件用tomcat7时,下面这个写法是可以的 <input id="test" type="hidden" ...
- BUG-jQuery提交表单submit方法-TypeError: e[h] is not a function
问题:button按钮设置id为submit后,表单jquery.submit()无法提交,报告异常TypeError: e[h] is not a function 源码: 解决:参考http:// ...
- 帝国cms发布信息时替换正文IMG图片标签里的ALT内容
帝国cms发布信息时替换正文IMG图片标签里的ALT内容 在 e/class/userfun.php 里面增加 //替换正文IMG里的ALT内容 function user_imgalt($mid,$ ...
- 大数据技术原理与应用——大数据处理架构Hadoop
Hadoop简介 Hadoop是Apache软件基金会旗下的一个开源分布式计算平台,为用户提供了系统底层细节透明的分布式基础架构. Hadoop是基于Java语言开发的,具有很好的跨平台特性,并且可以 ...
- mysql库地址
https://dev.mysql.com/downloads/connector/
- struts2学习笔记二
一.分文件编写框架配置文件 1.不分文件开发可能产生的问题 就类似于我们在写java类时,所有代码都写在一个类里,甚至写在一个方法里. 当3个人都checkout了struts.xml文件时,第一个人 ...
- Speed Up Your WordPress Site
http://www.sitepoint.com/speed-wordpress/ http://www.sparringmind.com/speed-up-wordpress/ http://www ...
- Java设计模式(1)——创建型模式之简单工厂模式(Simple Factory)
设计模式系列参考: http://www.cnblogs.com/Coda/p/4279688.html 一.概述 工厂模式主要是为创建对象提供过渡接口,以便将创建对象的具体过程屏蔽隔离起来,达到提高 ...