-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
41 lines (27 loc) · 796 Bytes
/
script.js
File metadata and controls
41 lines (27 loc) · 796 Bytes
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
// Claoing window function
function closeWindow(id) {
const win = document.getElementById(id);
win.classList.remove("active");
win.style.visibility = "hidden";
}
//Opening window function
function openWindow(id, btn) {
const win = document.getElementById(id);
if (btn) {
if (win.classList.contains("active")) {
closeWindow(id);
return;
}
win.style.visibility = "hidden";
win.classList.add("active");
const winRect = win.getBoundingClientRect();
const btnRect = btn.getBoundingClientRect();
win.style.left =
btnRect.left + btnRect.width / 2 - winRect.width / 2 + "px";
win.style.top =
btnRect.top - winRect.height - 12 + "px";
win.style.visibility = "visible";
return;
}
win.style.display = "block";
}