-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
40 lines (38 loc) · 977 Bytes
/
index.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
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<script src="js.js"></script>
</head>
<body>
<div>
<div class="text">
모달창 띄우기
</div>
<input type="button" value="Click!" class="click_button" id="open">
</div>
<div class = "modal hidden">
<div class="md_overlay">
</div>
<div class ="modal_window">
<div class="text">
자바스크립트 - 모달창 입니다.
</div>
<input type="button" value="Close" class="click_button" id="close">
</div>
</div>
<script>
const openButton = document.querySelector("#open");
const modal = document.querySelector(".modal");
const closeButton = modal.querySelector("#close");
const openModal = () => {
modal.classList.remove("hidden");
}
const closeModal = () => {
modal.classList.add("hidden");
}
openButton.addEventListener("click", openModal);
closeButton.addEventListener("click", closeModal);
</script>
</body>
</html>