效果:
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, user-scalable=no"/>
<title>弹出微信遮罩层</title>
<style>
* {
margin: 0;
padding: 0;
}
#container {
position: relative;
width: fit-content;
height: auto;
margin: 0 auto;
overflow: hidden;
}
#pop {
display: none;
position: fixed;
left: 0;
top: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.8);
filter: alpha(opacity=80);
z-index: 100;
margin: 0 auto;
width: 100%;
height: 100%;
margin: 0 auto;
}
.close {
margin-top: 100px;
margin-left: 100px;
width: 40px;
height: 40px;
}
.close img {
width: 40px;
height: 40px;
}
.step {
font-size: 1em;
color: white;
width: 80%;
margin: 0 auto;
}
.step .step2 img{
width: 100%;
height: 100%;
}
.direction {
position: absolute;
right: 40px;
top: 40px;
width: 40px;
height: 40px;
}
.direction img {
width: 40px;
height: 40px;
}
</style>
</head>
<body>
<div id="container">
<button onClick="click_pop()"><img src="images/bbb.png"/></button>
<div id="pop">
<div class="close" onClick="close_pop()"><img src="images/close.png" alt="关闭"/></div>
<div class="step">
<div class="step2"><img src="images/step12.png"></div>
<!--<p><span>添加图标</span>点击右上角的<span>添加图标</span>按钮</p>
<p><span>添加图标</span>选择<span>添加图标</span></p>-->
</div>
<a href="##">
<div class="direction"><img src="images/d.png" alt="关闭"/></div>
</a>
</div>
</div>
<script>
function click_pop() {
document.getElementById('pop').style.setProperty('display', 'block');
}
function close_pop() {
document.getElementById('pop').style.setProperty('display', 'none');
}
</script>
</body>
</html>
图片:(中间有两个白色的图片,鼠标放上会变为放大镜,可保存下来放进项目中)