Skip to content

Instantly share code, notes, and snippets.

View MohamedRajabMohammed's full-sized avatar

Mohamed Rajab Mohammed MohamedRajabMohammed

View GitHub Profile
/_ 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;
@MohamedRajabMohammed
MohamedRajabMohammed / countdown.css
Created July 21, 2020 23:49
Positioning the Countdown and Numbers
.countdown {
position: relative;
display: block;
text-indent: -9999px;
overflow: hidden;
margin-left: 6px;
}
.numbers {
position: absolute;
// 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
// 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;
function createTimer() {
clearInterval(interval);
count = 0;
numbersArea.style.transform = 'translateY(0)'
// other code goes here...
// interval = setInterval(() => {...
}