-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtranchui.js
More file actions
36 lines (34 loc) · 1.2 KB
/
Copy pathtranchui.js
File metadata and controls
36 lines (34 loc) · 1.2 KB
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
function openModal(id) {
var modal = document.getElementById(id);
var modalContent = modal.getElementsByClassName("modal-content");
var closeButton = modal.getElementsByClassName("close");
modal.classList.add("active");
modal.style.animation = "fadeIn 500ms";
document.body.style.overflow = "hidden";
closeButton[0].addEventListener(
"click",
(e) => {
modalContent[0].style.animation = "slideUp 500ms";
modal.style.animation = "fadeOut 500ms";
setTimeout(function () {
modal.classList.remove("active");
modal.style.animation = "none";
modalContent[0].style.animation = "slideDown 500ms";
}, 500);
document.body.style.overflow = "scroll";
},
{ once: true }
);
}
function closeModal(id) {
var modal = document.getElementById(id);
var modalContent = modal.getElementsByClassName("modal-content");
modalContent[0].style.animation = "slideUp 500ms";
modal.style.animation = "fadeOut 500ms";
setTimeout(function () {
modal.classList.remove("active");
modal.style.animation = "none";
modalContent[0].style.animation = "slideDown 500ms";
}, 500);
document.body.style.overflow = "scroll";
}