Skip to content

Commit dd84e24

Browse files
Merge pull request #18 from KryptonANSHU/CountDown_App
Count down app
2 parents ec564fd + c2c38c6 commit dd84e24

5 files changed

Lines changed: 135 additions & 0 deletions

File tree

187 KB
Loading

New Year CountDown App/Readme.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This is a basic Web App that tells how uch time is left for the NEW YEAR :)
2+
3+
![image](https://user-images.githubusercontent.com/72062616/193441853-619f9e43-8b74-4e3a-9bf1-0814b3ea9f5a.png)

New Year CountDown App/index.html

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,400;1,200&display=swap');
2+
@import url('https://fonts.googleapis.com/css2?family=Ubuntu:ital,wght@1,500&display=swap');
3+
4+
5+
6+
7+
*{
8+
box-sizing: border-box;
9+
}
10+
11+
body{
12+
margin: 0px;
13+
background: url('Images/bg1.jpg') no-repeat;
14+
background-size: cover;
15+
/* background-position: center center; */
16+
min-height: 100vh;
17+
font-family: 'Poppins', sans-serif;
18+
display: flex;
19+
flex-direction: column;
20+
align-items: center;
21+
22+
}
23+
h1{
24+
25+
font-size: 4.2rem;
26+
font-weight: 400;
27+
margin-top: 5rem;
28+
}
29+
30+
.whole-elem{
31+
text-align: center;
32+
}
33+
34+
.con{
35+
display: flex;
36+
/* border: 5px solid #ffffff9c;
37+
padding: 15px 70px ; */
38+
}
39+
40+
.big-text{
41+
text-align: center;
42+
font-size: 6rem;
43+
margin: 0px 60px;
44+
}
45+
46+
.whole-elem span{
47+
font-size: 1.7rem;
48+
}

New Year CountDown App/script.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
let daysEl = document.getElementById('days');
2+
let hourEl = document.getElementById('hours');
3+
let minEl = document.getElementById('mins');
4+
let secEl = document.getElementById('sec');
5+
6+
7+
function countdown(){
8+
9+
var currentTime= new Date().getTime(); // Curent Time
10+
const newYear = new Date("dec 31, 2022 23:59:59").getTime(); // destination time
11+
12+
var difference = newYear - currentTime;
13+
// you have got the answere but in milliseconds
14+
15+
var seconds,hours,days,minutes;
16+
seconds = Math.floor((difference%(1000*60)/1000));
17+
minutes = Math.floor(difference%(1000*60*60)/(1000*60));
18+
hours = Math.floor((difference%(1000*60*60*24))/(1000*60*60));
19+
days = Math.floor(difference/(1000*60*60*24));
20+
21+
daysEl.innerHTML = days;
22+
hourEl.innerHTML =Timeformat(hours);
23+
minEl.innerHTML = Timeformat(minutes);
24+
secEl.innerHTML = Timeformat(seconds);
25+
26+
};
27+
28+
function Timeformat (time) {
29+
if(time < 10)
30+
return (`0${time}`);
31+
else
32+
return time;
33+
}
34+
35+
setInterval(countdown,1000) //Updtaes the function every 1 sec
36+
// 1000ms = 1 sec

New Year CountDown App/style.css

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,400;1,200&display=swap');
2+
@import url('https://fonts.googleapis.com/css2?family=Ubuntu:ital,wght@1,500&display=swap');
3+
4+
5+
6+
7+
*{
8+
box-sizing: border-box;
9+
}
10+
11+
body{
12+
margin: 0px;
13+
background: url('Images/bg1.jpg') no-repeat;
14+
background-size: cover;
15+
/* background-position: center center; */
16+
min-height: 100vh;
17+
font-family: 'Poppins', sans-serif;
18+
display: flex;
19+
flex-direction: column;
20+
align-items: center;
21+
22+
}
23+
h1{
24+
25+
font-size: 4.2rem;
26+
font-weight: 400;
27+
margin-top: 5rem;
28+
}
29+
30+
.whole-elem{
31+
text-align: center;
32+
}
33+
34+
.con{
35+
display: flex;
36+
/* border: 5px solid #ffffff9c;
37+
padding: 15px 70px ; */
38+
}
39+
40+
.big-text{
41+
text-align: center;
42+
font-size: 6rem;
43+
margin: 0px 60px;
44+
}
45+
46+
.whole-elem span{
47+
font-size: 1.7rem;
48+
}

0 commit comments

Comments
 (0)