Skip to content

Instantly share code, notes, and snippets.

@vinayakg
Created December 19, 2020 23:20
Show Gist options
  • Save vinayakg/8368d40a7a8abeddee2c54fad35b8871 to your computer and use it in GitHub Desktop.
Save vinayakg/8368d40a7a8abeddee2c54fad35b8871 to your computer and use it in GitHub Desktop.
maintenance.html
<!DOCTYPE html>
<html>
<style>
body, html {
background-image: url('https://www.w3schools.com/w3images/forestbridge.jpg');
height: 100%;
margin: 0;
position: fixed;
width: 100%;
}
.bgimg {
height: 100%;
background-position: center;
background-size: cover;
position: relative;
color: white;
font-family: "Courier New", Courier, monospace;
font-size: 25px;
}
.middle {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
}
</style>
<body>
<div class="bgimg">
<div class="middle">
<h1>Site is Under Maintenance</h1>
<hr>
<p id="demo" style="font-size:30px"></p>
</div>
<div class="bottomleft">
</div>
</div>
<!--<script type="application/javascript" src="https://d1idiaqkpcnv43.cloudfront.net/maintenance.js"></script>-->
// Set the date we're counting down to
var countDownDate = new Date("Dec 20, 2020 08:00:00").getTime();
// Update the count down every 1 second
var countdownfunction = setInterval(function() {
// Get todays date and time
var now = new Date().getTime();
// Find the distance between now an the count down date
var distance = countDownDate - now;
// Time calculations for days, hours, minutes and seconds
var days = Math.floor(distance / (1000 * 60 * 60 * 24));
var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
var seconds = Math.floor((distance % (1000 * 60)) / 1000);
// Output the result in an element with id="demo"
document.getElementById("demo").innerHTML = days + "d " + hours + "h "
+ minutes + "m " + seconds + "s ";
// If the count down is over, write some text
if (distance < 0) {
clearInterval(countdownfunction);
document.getElementById("demo").innerHTML = "EXPIRED";
}
}, 1000);
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment