-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
46 lines (36 loc) · 1.26 KB
/
index.js
File metadata and controls
46 lines (36 loc) · 1.26 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
37
38
39
40
41
42
43
44
45
46
// Grab needed html elements from html file
var sidebar = document.querySelector("#sidebar");
var closeIcon = document.querySelector("#close-icon");
var MobileIcon = document.querySelector("#mobile-icon");
// Show Mobile Icon
function show() {
sidebar.style.opacity = "100%";
sidebar.style.top = "0";
}
function hide() {
sidebar.style.opacity = "0";
sidebar.style.top = "-100%";
}
closeIcon.addEventListener("click", hide);
MobileIcon.addEventListener("click", show);
// StopWatch Logic
const countdown = () => {
const countDate = new Date("September 20, 2023 00:00:00").getTime();
const now = new Date().getTime();
const gap = countDate - now;
const second = 1000;
const minute = second * 60;
const hour = minute * 60;
const day = hour * 24;
// Calculate
const textDay = Math.floor(gap / day);
const textHour = Math.floor((gap % day) / hour);
const textMinute = Math.floor((gap % hour) / minute);
const textSecond = Math.floor((gap % minute) / second);
document.querySelector('.day').innerHTML = textDay;
document.querySelector('.hour').innerHTML = textHour;
document.querySelector('.min').innerHTML = textMinute;
document.querySelector('.second').innerHTML = textSecond;
};
setInterval(countdown, 1000);
// <GROUP 3 VOTING SYSTEM PROJECT />