Merel
1
Hi guys,
Does anyone know if I can build in some kind of numertor in Wix Editor? I want it to be done like they do at:
It looks like this:
But anytime you refresh the website, these numbers will go from 0 to the numbers in the image.
I hope this makes sense and that anyone can help me with that!
Kind regards,
Merel van Wolferen
There’s a few apps on the app market that offer this, such as this one - Final Count Up | Wix App Market | Wix.com
Or if you’re looking for a coded solution, something like:
I have used this before
$w.onReady(function () {
function countElement(element, startValue, endValue, prefix = "", suffix = "") {
const duration = 2000;
const increment = (endValue - startValue) / (duration / 20);
let currentValue = startValue;
const timer = setInterval(() => {
currentValue += increment;
$w(element).text = prefix + `${(Math.round(currentValue)).toLocaleString('en-US')}${suffix}`;
if (currentValue >= endValue) {
clearInterval(timer);
}
}, 20);
}
$w("#Counters").onViewportEnter(async () => {
await countElement("#text81", 0, 54, "", "+");
await countElement("#text84", 0, 100, "", "+");
await countElement("#text86", 0, 1, "", " hr");
await countElement("#text88", 0, 100, "", " %");
});
});
2 Likes