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
/_ button styles are here _/ | |
button { | |
background: white; | |
border-radius: 5px; | |
border: none; | |
padding: 15px 30px; | |
font-size: 24px; | |
font-family: 'Muli'; | |
display: block; | |
text-transform: uppercase; |
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
.countdown { | |
position: relative; | |
display: block; | |
text-indent: -9999px; | |
overflow: hidden; | |
margin-left: 6px; | |
} | |
.numbers { | |
position: absolute; |
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
// grab parts of our HTML | |
const countdownArea = document.querySelector('.countdown'); | |
const numbersArea = document.querySelector('.numbers'); | |
const resetBtn = document.querySelector('.reset'); | |
// create an interval and counter | |
let interval; | |
let count = 0; | |
// calculate the height of our numbers |
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
// create the interval that creates the timer | |
function createTimer() { | |
interval = setInterval(() => { | |
// 1. increment our count | |
count++; | |
// 2. calculate the offset and apply it | |
const offset = height * count; |
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
function createTimer() { | |
clearInterval(interval); | |
count = 0; | |
numbersArea.style.transform = 'translateY(0)' | |
// other code goes here... | |
// interval = setInterval(() => {... | |
} |
OlderNewer