Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
55 lines (49 sloc) 1.23 KB
<html>
<head>
<title>弹框遮罩</title>
</head>
</html>
<body>
<style>
.dialog {
width: 600px;
height: 400px;
background: #ffffff;
position: fixed;
top: 50%;
left: 50%;
margin-left: -300px;
margin-top: -200px;
z-index: 9999
}
.shade {
BACKGROUND-COLOR: black;
opacity: 0.4;
z-index: 9998;
width: 100%;
height: 100%;
position: fixed;
left: 0;
top: 0;
}
</style>
<!--此层代码用于盖住BODY内容-->
<div class="shade" style="display: none;"></div>
<div class="dialog" style="display: none;">这里是弹框内容</div>
<a onclick="showdialog()">显示弹框</a>
</body>
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
<script>
function showdialog(code) {
$('.dialog').show();
$('.shade').show();
}
function hidedialog() {
$('.dialog').hide();
$('.shade').hide();
}
$(".shade").click(function () {
hidedialog();
});
</script>