-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.html
74 lines (69 loc) · 1.93 KB
/
model.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Model POP up box</title>
<style>
body {
width: 1000px;
margin: 20px auto;
}
#backdrop {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: black;
opacity: 0.5;
display: none;
}
#model {
position: absolute;
top: 15%;
left: 30%;
width: 40%;
height: 250px;
background: #222;
display: none;
}
#model h2 {
display: flex;
justify-content: space-between;
color: white;
font-size: 24px;
margin: 0;
padding: 20px;
background: #333;
}
#model h2 span {
color: red;
cursor: pointer;
}
</style>
</head>
<body>
<h1>Model</h1>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Nisi, voluptas.</p>
<button>Button</button>
<div id="backdrop">
</div>
<div id="model">
<h2>Model Title<span>×</span></h2>
</div>
<script>
document.querySelector("#model h2 span").onclick = hide;
document.querySelector("#backdrop").onclick = hide;
document.querySelector("button").onclick = show;
function show( ) {
document.querySelector("#backdrop").style.display = "block";
document.querySelector("#model").style.display = "block";
}
function hide( ) {
document.querySelector("#backdrop").style.display = "none";
document.querySelector("#model").style.display = "none";
}
</script>
</body>
</html>