-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathoverlay_library.html
49 lines (48 loc) · 1.2 KB
/
overlay_library.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>overlay</title>
<style>
.overlay {
position: fixed;
left: 0;
right: 0;
bottom: 0;
top: 0;
background: rgba(0, 0, 0, 0.8);
display: none;
}
.overlay article {
width: 400px;
height: 400px;
position: absolute;
left: 50%;
top: 50%;
margin: -200px 0 0 -200px;
text-align: center;
}
</style>
</head>
<body>
<button id="btn">弹出窗口</button>
<div class="overlay">
<article>
I am Jchermy
</article>
</div>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script>
$('#btn').click(function(){
$('.overlay').show();
})
$('.overlay').click(function(e){
if(e.target == e.currentTarget) {
$('.overlay').hide();
}
})
</script>
</body>
</html>