-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathp7.html
88 lines (76 loc) · 1.95 KB
/
p7.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Debug Challenge - Modal</title>
<style>
body {
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Ubuntu, 'Open Sans', 'Helvetica Neue', sans-serif;
background-color: #003b75;
color: white;
}
.modal {
display: block;
position: relative;
z-index: -1;
padding-top: 10px;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgb(0,0,0);
background-color: rgba(0,0,0,0.4);
backdrop-filter: blur(1px);
}
/* Modal Content */
.modal-content {
background-color: #0a83c9;
margin: auto;
padding: 0px 20px 80px 20px;
border: 2px solid #ffffff;
width: 80%;
border-radius: 1rem;
}
.close {
color: #aaaaaa;
float: right;
font-size: 28px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: #000;
text-decoration: none;
cursor: pointer;
}
</style>
</head>
<body>
<h2>A modal is a web page element that displays in front of and deactivates all other page content. The general purpose of modals is to grab attention and encourage actions.</h2>
<p>Make the modal functional by fixing its position. Upon pressing the open button, the modal should open on top of the window.</p>
<button id="btn">Open</button>
<div id="moo" class="modal">
<div class="modal-content">
<span class="close">×</span>
<p><img src="" alt="">Is your modal is working properly?</p>
</div>
</div>
<script>
var modal = document.getElementById("moo");
var btn = document.getElementById("btn");
var span = document.getElementsByClassName("close")[0];
btn.onclick = function() {
modal.style.display = "block";
}
span.onclick = function() {
modal.style.display = "none";
}
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
</script>
</body>
</html>