-
Notifications
You must be signed in to change notification settings - Fork 0
/
timeline.js
85 lines (80 loc) · 2.51 KB
/
timeline.js
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
// Get all modals
var essayModal = document.getElementById("essayModal");
var t1Modal = document.getElementById("t1Modal")
var t2Modal = document.getElementById("t2Modal")
var t3Modal = document.getElementById("t3Modal")
var t4Modal = document.getElementById("t4Modal")
var t5Modal = document.getElementById("t5Modal")
// Get all buttons that opens the modals
var essayBtn = document.getElementById("essayBtn");
var t1Btn = document.getElementById("t1Btn");
var t2Btn = document.getElementById("t2Btn");
var t3Btn = document.getElementById("t3Btn");
var t4Btn = document.getElementById("t4Btn");
var t5Btn = document.getElementById("t5Btn");
// Get the <span> element that closes the modal
var essayClose = document.getElementsByClassName("essayClose")[0];
var t1Close = document.getElementsByClassName("t1Close")[0];
var t2Close = document.getElementsByClassName("t2Close")[0];
var t3Close = document.getElementsByClassName("t3Close")[0];
var t4Close = document.getElementsByClassName("t4Close")[0];
var t5Close = document.getElementsByClassName("t5Close")[0];
// When the user clicks the button, open the modal
essayBtn.onclick = function() {
essayModal.style.display = "block";
}
t1Btn.onclick = function() {
t1Modal.style.display = "block";
}
t2Btn.onclick = function() {
t2Modal.style.display = "block";
}
t3Btn.onclick = function() {
t3Modal.style.display = "block";
}
t4Btn.onclick = function() {
t4Modal.style.display = "block";
}
t5Btn.onclick = function() {
t5Modal.style.display = "block";
}
// When the user clicks on <span> (x), close the modal
essayClose.onclick = function() {
essayModal.style.display = "none";
}
t1Close.onclick = function() {
t1Modal.style.display = "none";
}
t2Close.onclick = function() {
t2Modal.style.display = "none";
}
t3Close.onclick = function() {
t3Modal.style.display = "none";
}
t4Close.onclick = function() {
t4Modal.style.display = "none";
}
t5Close.onclick = function() {
t5Modal.style.display = "none";
}
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == essayModal) {
essayModal.style.display = "none";
}
else if (event.target == t1Modal) {
t1Modal.style.display = "none";
}
else if (event.target == t2Modal) {
t2Modal.style.display = "none";
}
else if (event.target == t3Modal) {
t3Modal.style.display = "none";
}
else if (event.target == t4Modal) {
t4Modal.style.display = "none";
}
else if (event.target == t5Modal) {
t5Modal.style.display = "none";
}
}