Frida
KPCKevin Powell - Community
•Created by Frida on 8/19/2023 in #front-end
Space Travel Project - Button hover state
Thank you!
6 replies
KPCKevin Powell - Community
•Created by Frida on 8/19/2023 in #front-end
Space Travel Project - Button hover state
Thank you!
as long as the method doesn't use any bad practicesThat's the key 😁 I don't think there is any bad practice, but wanted to get some other opinions on that too 🙂
6 replies
KPCKevin Powell - Community
•Created by chinto11 on 8/17/2023 in #front-end
counter up
.. Or, if you don't want to deal with the loop:
let count = 0;
let int = setInterval(counting, 300);
function counting() {
count++;
if (count > 15) {
clearInterval(int)
}
counter.innerText = count
}
counting()
14 replies
KPCKevin Powell - Community
•Created by chinto11 on 8/17/2023 in #front-end
counter up
You can adjust the count speed with the number behind the ',' in the setIntervall functions
14 replies
KPCKevin Powell - Community
•Created by chinto11 on 8/17/2023 in #front-end
counter up
DON'T forget to break 😉
14 replies
KPCKevin Powell - Community
•Created by chinto11 on 8/17/2023 in #front-end
counter up
Good old plain vanilla js, no library import needed 🙂
14 replies
KPCKevin Powell - Community
•Created by chinto11 on 8/17/2023 in #front-end
counter up
const counter = document.getElementById('child');
let i = 0;
let count = 0;
while (i <= 10) {
setInterval(() => {
if (i <= 10) {
counter.innerHTML = count += 1
i++;
}
}, 300);
break
}
// You can replace i length with any array or string length
HTML:
<h1 id="main-title">
COUNTER
<span id="child"></span>
</h1>
14 replies