-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
92 lines (71 loc) · 2.7 KB
/
index.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
86
87
88
89
90
91
92
// FAQ
// Animate FAQ expand
let acc = document.getElementsByClassName("FAQ-question-header");
let arr = document.getElementsByClassName("FAQ-arrow");
let i;
for (i = 0; i < acc.length; i++) {
// click function for the question itself
acc[i].addEventListener("click", function() {
// Show hidden answer
let panel = this.nextElementSibling.nextElementSibling;
if (panel.style.maxHeight) {
panel.style.maxHeight = null;
} else {
panel.style.maxHeight = panel.scrollHeight + "px";
}
// Flip arrow
let arrow = this.nextElementSibling;
if (!arrow.style.transform) {
arrow.style.transform = "rotate(180deg)";
} else {
arrow.style.transform = "";
}
});
// click function for the arrows
arr[i].addEventListener("click", function() {
// Show hidden answer
let panel = this.nextElementSibling;
if (panel.style.maxHeight) {
panel.style.maxHeight = null;
} else {
panel.style.maxHeight = panel.scrollHeight + "px";
}
// Flip arrow
let arrow = this;
if (!arrow.style.transform) {
arrow.style.transform = "rotate(180deg)";
} else {
arrow.style.transform = "";
}
});
}
// Landing page nav bar
// Open navbar on click
function openNav() {
document.getElementById("mySidebar").style.width = "250px";
document.getElementById("main").style.marginLeft = "250px";
document.getElementById("ghost-byte1").style.marginLeft = "250px";
}
// Close navbar on click */
function closeNav() {
document.getElementById("mySidebar").style.width = "0";
document.getElementById("main").style.marginLeft = "0";
document.getElementById("ghost-byte1").style.marginLeft = "0";
}
// hackathon countdown
let hackathonDate = new Date("Oct 29, 2022 00:00:00").getTime();
var x = setInterval(function(){
let today = new Date().getTime();
//distance between now and the hackathon date:
var difference = hackathonDate - today;
//calculate days, hours, minutes and seconds
var days = Math.floor(difference / (1000 * 60 * 60 * 24));
var hours = Math.floor((difference % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes = Math.floor((difference % (1000 * 60 * 60)) / (1000 * 60));
var seconds = Math.floor((difference % (1000 * 60)) / 1000);
document.getElementById("time").innerHTML = "";
document.getElementById("days").innerHTML = days;
document.getElementById("minutes").innerHTML = minutes;
document.getElementById("seconds").innerHTML = seconds;
document.getElementById("hours").innerHTML = hours;
}, 1000);