Adding a countdown to the homepage
This commit is contained in:
parent
7742bf21bf
commit
7146046ee0
2 changed files with 67 additions and 40 deletions
|
|
@ -1,9 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="/style.css">
|
||||
</head>
|
||||
<body>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1 class="title fontXL textCenter backgroundLightGreen colorWhite">Collin and Lucy's Wedding</h1>
|
||||
<div class="contents fontM">
|
||||
<a class="rsvpButton backgroundLightGreen hidden" href="/rsvp">
|
||||
|
|
@ -16,8 +18,11 @@
|
|||
<div>
|
||||
<h2 class="textLeft fontL colorLightGreen">When?</h2>
|
||||
<p>Saturday 16th of May 2026</p>
|
||||
<b>
|
||||
<p id="countdown"></p>
|
||||
</b>
|
||||
|
||||
<br/>
|
||||
<br />
|
||||
|
||||
<h3 class="colorLightGreen fontM">Agenda</h3>
|
||||
<ul>
|
||||
|
|
@ -27,21 +32,26 @@
|
|||
<li>18:30 - Dinner</li>
|
||||
</ul>
|
||||
|
||||
<br/>
|
||||
<br />
|
||||
|
||||
<h2 class="textLeft colorLightGreen fontL">Where?</h2>
|
||||
<a href="https://www.broekerhuis.nl/">
|
||||
<p>
|
||||
Het Broeker Huis <br/>
|
||||
Leeteinde 16 <br/>
|
||||
Het Broeker Huis <br />
|
||||
Leeteinde 16 <br />
|
||||
1151AK Broek in Waterland
|
||||
</p>
|
||||
</a>
|
||||
<br/>
|
||||
<iframe class="map" src="https://www.openstreetmap.org/export/embed.html?bbox=4.991877973079682%2C52.436195297048144%2C4.994031786918641%2C52.43801523045145&layer=mapnik&marker=52.43710609072568%2C4.992956221103668" style="border: 1px solid black"></iframe><br/>
|
||||
<a href="https://www.openstreetmap.org/node/2869212621"><h5 class="fontS">Open Map</h5></a>
|
||||
<br />
|
||||
<iframe class="map"
|
||||
src="https://www.openstreetmap.org/export/embed.html?bbox=4.991877973079682%2C52.436195297048144%2C4.994031786918641%2C52.43801523045145&layer=mapnik&marker=52.43710609072568%2C4.992956221103668"
|
||||
style="border: 1px solid black"></iframe><br />
|
||||
<a href="https://www.openstreetmap.org/node/2869212621">
|
||||
<h5 class="fontS">Open Map</h5>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/index.js"></script>
|
||||
</body>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -8,10 +8,27 @@ function hasRsvped() {
|
|||
return cookies[COOKIE_NAME] === "true";
|
||||
}
|
||||
|
||||
function padTime(t) {
|
||||
return `${t}`.padStart(2, '0');
|
||||
}
|
||||
|
||||
function updateCountdown() {
|
||||
const countdownDate = new Date("2026-05-16T14:30:00.000+02:00");
|
||||
const now = new Date();
|
||||
const msRemaining = countdownDate.getTime() - now.getTime();
|
||||
const daysRemaining = Math.floor(msRemaining / (1000 * 60 * 60 * 24));
|
||||
const hoursRemaining = Math.floor(msRemaining / (1000 * 60 * 60)) % 24;
|
||||
const minutesRemaining = Math.floor(msRemaining / (1000 * 60)) % 60;
|
||||
const secondsRemaining = Math.floor(msRemaining / 1000) % 60;
|
||||
const countdownNode = document.getElementById("countdown");
|
||||
countdownNode.innerText = `${daysRemaining} days ${padTime(hoursRemaining)}:${padTime(minutesRemaining)}:${padTime(secondsRemaining)}`;
|
||||
}
|
||||
|
||||
window.onload = function () {
|
||||
if (!hasRsvped()) {
|
||||
const rsvpButton = document.querySelector(".rsvpButton");
|
||||
rsvpButton.classList.remove("hidden");
|
||||
}
|
||||
updateCountdown();
|
||||
window.setInterval(updateCountdown, 500);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue