-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
123 lines (101 loc) · 3.4 KB
/
index.html
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css"
integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
<title></title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.wrap {
margin: 0 auto;
width: 100%;
height: 100vh;
background-color: #F1E9DE;
font-family: 'Roboto', sans-serif;
padding: 40px 20px 20px 20px;
}
p {
font-size: 2.5rem;
text-align: center;
color: #0A3A59;
}
#heart {
width: 100%;
padding: 10px 0 10px 0;
text-align: center;
opacity: 0;
}
#heart i {
font-size: 4rem;
color: #F42725;
}
h1 {
text-align: center;
color: #0A3A59;
font-size: 2.5rem;
}
h1 p:nth-child(2),
h1 p:nth-child(3),
h1 p:nth-child(4) {
display: inline-block;
font-size: 1.8rem;
}
</style>
</head>
<body>
<div class="wrap">
<p>We are together in: </p>
<div id="heart">
<i class="fas fa-heart"></i>
</div>
<h1>
<p><span class="d">00</span> days</p>
<p><span class="h">00</span> h.</p>
<p><span class="m">00</span> min.</p>
<p><span class="s">00</span> sec.</p>
</h1>
</div>
<script>
//timer
const endTime = new Date('2019-05-24 14:00:00').getTime();
const spanD = document.querySelector('span.d')
const spanH = document.querySelector('span.h')
const spanM = document.querySelector('span.m')
const spanS = document.querySelector('span.s')
var faint;
setInterval(() => {
const nowTime = new Date().getTime();
/*const time = Math.floor((endTime - nowTime) /1000);*/
const days = Math.floor((endTime / (1000 * 60 * 60 * 24)) - (nowTime / (1000 * 60 * 60 * 24)));
let houres = Math.floor((endTime / (1000 * 60 * 60) - nowTime / (1000 * 60 * 60)) % 24);
houres = houres < 10 ? `0${houres}` : houres;
let minutes = Math.floor((endTime / (1000 * 60) - nowTime / (1000 * 60)) % 60);
minutes = minutes < 10 ? `0${minutes}` : minutes;
let seconds = Math.floor((endTime / (1000) - nowTime / (1000)) % 60);
seconds = seconds < 10 ? `0${seconds}` : seconds;
spanD.textContent = days;
spanH.textContent = houres;
spanM.textContent = minutes;
spanS.textContent = seconds;
faint = 1 - (days/20);
}, 1000);
//heart animation
const heart = document.querySelector('#heart');
setInterval(() => {
if (heart.style.opacity != 0) {
heart.style.opacity = 0;
} else {
heart.style.opacity = faint;
}
}, 1000);
</script>
</body>
</html>