pengjiajia

<!DOCTYPE html>
<html>

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,
maximum-scale=1.0,user-scalable=no">
<title></title>
<style>
* {
margin: 0;
padding: 0;
}

.text-center {
text-align: center
}

#a {
width: 100px;
height: 36px;
line-height: 36px;
text-align: center;
background-color: #00BFFF;
border-radius: 5px;
margin-left: 150px;
}

#b {
display: none;
z-index: 9;
width: 260px;
height: 400px;
line-height: 400px;
border-radius: 5px;
text-align: center;
background-color: #fff;
position: fixed;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}

.mask {
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
background-color: #000;
opacity: 0.5;
z-index: 1;
}

img {
position: fixed;
left: 20px;
top: 20px;
display: none;
width: 30px;
height: 30px;
z-index: 999
}
</style>
</head>

<body>
<div class="text-center">
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<div id="a">点击</div>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
</div>
<div id="b">我是一个弹框</div>
<div id="m"></div>
<img id="c" src="img/close.gif" alt="" />
</body>
<script src="js/jquery-1.10.1.min.js"></script>
<script>
$(document).ready(function() {
$("#b").hide();
$("#a").click(function(e) {
$("#b").show();
$("#c").show();
$("#m").attr("class", "m mask");
});
});
$("#c").click(function() {
$("#b").hide();
$("#c").hide();
$("#m").attr("class", "m");
});
</script>

</html>

分类:

技术点:

相关文章: