I need to add an countdown and text on the home page, when the timer will run out it will redirect user to a product site. I already have the code done but I need help converting it to spotify. I need it to be a home page not a new page. I am using Dawn theme
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Countdown</title>
<link rel="preconnect" href="https://fonts.gstatic.com">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@500&display=swap" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="main.css">
</head>
<body>
<section class="coming-soon">
<div>
<h2>DROP 0/01</h2>
<div class="countdown">
<div class="container-day">
<h3 class="day text-color-main">Time</h3>
<h3>Days</h3>
</div>
<div class="container-hour">
<h3 class="hour text-color-main">Time</h3>
<h3>Hour</h3>
</div>
<div class="container-minute">
<h3 class="minute text-color-main">Time</h3>
<h3>Minute</h3>
</div>
<div class="container-second">
<h3 class="second text-color-main">Time</h3>
<h3>Second</h3>
</div>
</div>
</div>
</section>
<script src="timer.js"></script>
<video autoplay muted loop id="myVideo">
<source src="" type="video/mp4">
</body>
</html>
CSS
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Roboto';
}
h2{
font-size: 5rem;
font-weight: bold;
padding: 3rem;
color: #ffffff;
}
h3 {
color: #ffffff;
font-family: 'Roboto';
}
.coming-soon {
min-height: 100vh;
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
}
.countdown {
display: flex;
justify-content: space-around;
text-align: center;
}
.day,
.hour,
.minute,
.second {
font-size: 3rem;
}
.text-color-main {
background-color: #ffffff;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
color: transparent;
}
.waiting {
height: 50vh;
}
#myVideo {
position: fixed;
right: 0;
bottom: 0;
min-width: 100%;
min-height: 100%;
z-index: -1;
}
js
const countDown = () => {
const countDate = new Date('December 31, 2022 00:00:00').getTime(); // CHANGE THE TIME TO A DROP COUNTDOWN
const now = new Date().getTime();
const gap = countDate - now;
// Calculations for Time
const second = 1000;
const minute = second * 60;
const hour = minute * 60;
const day = hour * 24;
// Calculate missing days
const finalDay = Math.floor(gap / day);
const finalHour = Math.floor((gap % day) / hour);
const finalMinute = Math.floor((gap % hour) / minute);
const finalSecond = Math.floor((gap % minute) / second);
document.querySelector('.day').innerText = finalDay;
document.querySelector('.hour').innerText = finalHour;
document.querySelector('.minute').innerText = finalMinute;
document.querySelector('.second').innerText = finalSecond;
if(gap < 1000){
location.href = ''; //PRODUCT SITE
audio.play();
}
};
setInterval(countDown, 1000);