Last active
September 29, 2018 08:35
-
-
Save hfhchan/87c15984aafd87cf605e4e2ae44bc5a5 to your computer and use it in GitHub Desktop.
Flashing Countdown Timer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
target = new Date(2018, 8, 29, 17, 30, 0); | |
document.body.style.textAlign='center';document.body.style.color = 'green';document.body.style.font='bold 280px/1.1 Roboto,sans-serif';show=true; | |
window.setInterval(() => { | |
minsLeft = (target-(new Date())) / 60000; | |
document.body.innerHTML = `${Math.floor(minsLeft)} minutes left`; | |
if (minsLeft < 10) { | |
document.body.style.color = 'red'; | |
show=!show; | |
} | |
document.body.style.display = show? 'block' : 'none' | |
}, 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment