Skip to content

Commit

Permalink
Merge pull request iamrahulmahato#955 from amanver45/new-year
Browse files Browse the repository at this point in the history
New year countdown
  • Loading branch information
iamrahulmahato authored Oct 13, 2024
2 parents 0d5fcd1 + 9d6a5b8 commit 94b7668
Show file tree
Hide file tree
Showing 7 changed files with 137 additions and 2 deletions.
Binary file added assets/image/n.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 12 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1412,8 +1412,7 @@ <h3 class="card-heading">Stick Hero</h3>
<p class="card-description">
A fun popular game.
</p>
</div>
</a>



<a href="./projects/Among Us/index.html" class="card">
Expand Down Expand Up @@ -1516,6 +1515,17 @@ <h3 class="card-heading">Email Validator</h3>
</p>
</div>
</a>
<a href="./projects/New Year Countdown/index.html" class="card">
<div class="card-cover counter-cover-colour">
<img src="./assets/image/n.jpg" alt="new">
</div>
<div class="card-content">
<h3 class="card-heading">New Year Countdown</h3>
<p class="card-description">
New year countdown
</p>
</div>
</a>

<a href="./projects/Bill Splitter/index.html" class="card">
<div class="card-cover counter-cover-colour">
Expand Down
Binary file added projects/New Year Countdown/b.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions projects/New Year Countdown/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>New Year Countdown</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<h2>Countdown to New Year</h2>
<div class="year">2025</div>
<div class="countdown">
<div id="day">00</div>
<div id="hour">00</div>
<div id="minute">00</div>
<div id="second">00</div>
</div>
<script src="script.js"></script>
</body>
</html>
Binary file added projects/New Year Countdown/n.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions projects/New Year Countdown/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const dayEl = document.getElementById("day");
const hourEl = document.getElementById("hour");
const minuteEl = document.getElementById("minute");
const secondEl = document.getElementById("second");

const newYearTime = new Date("Jan 1, 2025 00:00:00").getTime();

updateCountdown();

function updateCountdown() {
const now = new Date().getTime();
const gap = newYearTime - now;

const second = 1000;
const minute = second * 60;
const hour = minute * 60;
const day = hour * 24;

const d = Math.floor(gap / day);
const h = Math.floor((gap % day) / hour);
const m = Math.floor((gap % hour) / minute);
const s = Math.floor((gap % minute) / second);
dayEl.innerText = d;
hourEl.innerText = h;
minuteEl.innerText = m;
secondEl.innerText = s;
setTimeout(updateCountdown, 1000)
}
76 changes: 76 additions & 0 deletions projects/New Year Countdown/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
body
{background-image: url(b.jpg);
}
body {
margin: 0;
display: flex;
flex-direction: column;
align-items: center;
height: 100vh;
justify-content: center;
font-family: cursive;
background-color: slateblue;
overflow: hidden;
}

h2 {
color: yellow;
text-align: center;
text-transform: uppercase;
letter-spacing: 4px;
font-size: xx-large;
}

.year {
font-size: 5em;
color: orange;
font-weight: bold;
}

.countdown {
margin: 30px;
background-color: rgba(0, 0, 0, 0.1);
width: 100%;
color: black;
height: 120px;
display: flex;
justify-content: center;
align-items: center;
}

.countdown div {
margin: 0 15px;
font-size: 2.5em;
font-weight: 500;
margin-top: -25px;
position: relative;
text-align: center;
width: 100px;
}

.countdown div::before {
content: "";
position: absolute;
bottom: -30px;
left: 0;
font-size: 0.35em;
line-height: 35px;
text-transform: uppercase;
letter-spacing: 1px;
font-weight: 500;
width: 100%;
height: 35px;
}

.countdown #day::before {
content: "Days";
}
.countdown #hour::before {
content: "Hours";
}
.countdown #minute::before {
content: "Minutes";
}
.countdown #second::before {
content: "Seconds";
}

0 comments on commit 94b7668

Please sign in to comment.