js+html5实现半透明遮罩层弹框效果实现半透明遮罩层弹框效果
主要为大家详细介绍了js+html5实现半透明遮罩层弹框效果,具有一定的参考价值,感兴趣的小伙伴们可以参考
一下
点击按钮,出现半透明遮罩层弹框,说说自己之前发过的愁吧
1、遮罩层半透明了 弹框也跟着半透明了 就像这样 绝望吧
是哪里错了呢?你的css是这样写的吧:
应该这样:
需要注意的是这几个参数的意思:RGB Red Green Bule 3色!及212, 0, 0 三色的值混合 .最后一个参数 0.5 是指的透明度 1表
示不透明
2、半遮罩层里面的内容可以上下滑动 感觉挺好玩的 /笑哭
修改就是把半遮罩层的position设置为fixed 里面的内容就不会变啦
接下来就是代码show
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<style type="text/css">
*{
margin: 0;
padding: 0;
}
.tip{
text-align: center;
position: absolute;
height: 100%;
width: 100%;
background-color: rgba(90, 90, 90, 0.5);
z-index: 99999;
}
.collectSucc{
position: fixed;
height: auto;
width: 70%;
background-color: #ffffff;
margin-left: 15%;
margin-top: 50%;
}
.collectSucc_top{
color: #666666;
font-size: 12px;
}
.collectSucc_top img{
width: 60px;
margin-top: 20px;
}
.collectSucc_buttom{
margin-top: 20px;
height: 40px;
line-height: 40px;
background-color: #2d99f5;
color: #FFFFFF;
font-size: 13px;
}
</script>
</head>
评论0