Merry Christmas to All!!!
5 Likes
Isn’t it tomorrow??
1 Like
Less than 11 hours for me
1 Like
14 hours for me… Lets just stick to GMT. Hence time left is 18.73 hours
1 Like
index.html
file contents
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Merry Christmas Countdown | InfinityFree Forum</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="https://d29hzik3xqzv4r.cloudfront.net/original/1X/90345a3ee4094a38a00c9061dfb1744c2004aa6e.png" type="image/x-icon">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class = "container">
<video autoplay muted loop id = "bg-video">
<source src = "bg.mp4" type = "video/mp4">
</video>
<div class = "content">
<h1>Christmas Is Coming</h1>
<blockquote>
<sup>
<span><i class = "fas fa-quote-left"></i></span>
</sup>
WE WISH YOU A MERRRY CHRISTMAS AND HAPPY NEW YEAR
<sup>
<span><i class = "fas fa-quote-right"></i></span>
</sup>
</blockquote>
<div class = "time-show">
<div>
<span id = "days"></span>
<p>days</p>
</div>
<div>
<span id = "hours"></span>
<p>hours</p>
</div>
<div>
<span id = "minutes"></span>
<p>minutes</p>
</div>
<div>
<span id = "seconds"></span>
<p>seconds</p>
</div>
</div>
<h3>
© 2021. Built For The InfinityFree Community By <a href="https://forum.infinityfree.com/u/jaikrishna.t" target="_blank">jaikrishna.t</a> .
</h3>
</div>
</div>
<script src="script.js"></script>
</body>
</html>
style.css
file contents
@import url('https://fonts.googleapis.com/css2?family=Poppins&display=swap');
*{
padding: 0;
margin: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}
body{
line-height: 1.6;
}
.container{
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
position: relative;
padding: 0 1.2rem;
}
.container::after{
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background:rgba(0, 0, 0, 0.3);
}
#bg-video{
position: absolute;
z-index: -1;
width: 100%;
height: 100%;
object-fit: cover;
}
.content{
z-index: 1;
color: #fff;
margin: 3rem 0;
}
.content h1{
font-size: 2rem;
text-transform: uppercase;
font-family: var(--largeFont);
letter-spacing: 6px;
word-spacing: 5px;
position: relative;
padding-bottom: 0.8rem;
}
.content h1::after{
position: absolute;
content: "";
bottom: 0;
left: 50%;
transform: translateX(-50%);
height: 1px;
border-radius: 5px;
width: 60%;
background: #ffbf00;
}
.content h2{
font-size: 1.15rem;
font-weight: 400;
text-transform: uppercase;
letter-spacing: 7px;
padding-top: 1.2rem;
}
.time-show{
margin: 3.5rem 0;
display: flex;
flex-direction: column;
align-items: center;
}
.time-show div{
background: #fff;
margin: 0.5rem;
width: 150px;
height: 140px;
color: #000;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.time-show div span{
display: block;
font-size: 3rem;
font-weight: 400;
opacity: 0.9;
}
.time-show div p{
color: #B11809;
text-transform: uppercase;
font-size: 1.2rem;
letter-spacing: 2px;
font-weight: 600;
}
.container blockquote{
font-size: 1.2rem;
font-weight: 400;
text-transform: uppercase;
letter-spacing: 2px;
}
.container blockquote span{
font-size: 0.6rem;
display: inline-block;
}
.container a {
color: #0097FF;
}
@media screen and (min-width: 480px){
.content h1{
font-size: 3rem;
}
.time-show{
flex-direction: row;
flex-wrap: wrap;
}
.time-show div{
flex: 0 0 calc(50% - 1rem);
width: 190px;
height: 180px;
}
}
@media screen and (min-width: 768px){
.content h1{
font-size: 3.4rem;
}
}
@media screen and (min-width: 992px){
.container{
padding: 0 3rem;
}
.time-show div{
flex: 0 0 calc(25% - 1rem);
}
}
script.js
file contents
const days = document.getElementById('days'),
minutes = document.getElementById('minutes'),
hours = document.getElementById('hours'),
seconds = document.getElementById('seconds');
let xYear = 2020;
setInterval(() => {
findDate();
}, 1000);
function findDate(){
let currentTime = new Date(),
christmasYear = currentTime.getFullYear();
// getMonth() method returns the month (from 0 to 11)
if(currentTime.getMonth() == 11 && currentTime.getDate() > 25){
christmasYear += 1;
}
let christmasTime = new Date(christmasYear, 11, 25);
let dateDiff = Math.floor(christmasTime - currentTime);
let DAYS = 0, HOURS = 0, MINUTES = 0, SECONDS = 0;
if(currentTime.getMonth() != 11 || (currentTime.getMonth() == 11 && currentTime.getDate() != 25)){
DAYS = Math.floor(dateDiff / (1000 * 60 * 60 * 24));
HOURS = Math.floor((dateDiff) % (1000 * 60 * 60 * 24) / (1000 * 60 * 60));
MINUTES = Math.floor((dateDiff % (1000 * 60 * 60)) / (1000 * 60));
SECONDS = Math.floor((dateDiff) % (1000 * 60) / 1000);
}
displayDate(setZero(DAYS), setZero(HOURS), setZero(MINUTES), setZero(SECONDS));
}
function displayDate(d, h, m, s){
days.innerHTML = d;
hours.innerHTML = h;
minutes.innerHTML = m;
seconds.innerHTML = s;
}
function setZero(timeValue){
if(timeValue < 10){
timeValue = "0" + timeValue;
}
return timeValue;
}
bg.mp4
video file
Full repo (just for this community)
2 Likes
This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.