<style>
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
font-family: 'Roboto', sans-serif;
background-color: #ffffff;
}
#count {
font-size: 32px;
font-weight: bold;
}
</style>
<body>
<div id="count">0</div>
<script>
let count = 0;
const target = 10000;
const speed = 10; // Adjust this value for speed control
function updateCount() {
const increment = target / 100; // Adjust to control increment speed
if (count < target) {
count += increment;
document.getElementById('count').textContent = Math.ceil(count).toLocaleString() + '+';
setTimeout(updateCount, speed);
} else {
document.getElementById('count').textContent = target.toLocaleString() + '+';
}
}
updateCount();
</script>
</body>
top of page
To see this working, head to your live site.
Edited: Jul 03, 2024
Dynamic Count-Up Number - Code
Dynamic Count-Up Number - Code
0 comments
Comments (0)
bottom of page