🥸NumScroller, Counter From Zero To Value - Javascript Animation (ok)
https://codepen.io/shivasurya/pen/yyBoJX
Example 0
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<section class="numbers">
<div class="container" id="main">
<h6 class="red-title">BY THE NUMBERS</h6>
<h2 class="stats-heading">We’ll always measure up to your expectations</h2>
<div class="numbers-box">
<h1 class="count" max-data="50">30</h1>
<h6>years of experience</h6>
</div>
<div class="numbers-box">
<h1 class="count" max-data="37">0</h1>
<h6>countires supplied</h6>
</div>
<div class="numbers-box">
<h1 class="count" max-data="128">0</h1>
<h6>group automation employees</h6>
</div>
</div>
</section>
<script>
var runAlready;
var counting;
function startCounter(a) {
runAlready = true;
counting = true;
$('.count').each(function () {
var $this = $(this);
$this.text(a);
countTo = $this.attr('max-data');
$({
countNum: $this.text()
}).animate({
countNum: countTo
},
{
duration: 2000,
easing: 'swing',
step: function () {
$this.text(Math.floor(this.countNum));
},
complete: function () {
$this.text(this.countNum);
counting = false;
}
});
})
}
$(window).scroll(function () {
var oTop = $('#main').offset().top;
var a = 0;
if (!runAlready && $(window).scrollTop() > oTop || !counting && $(window).scrollTop() < oTop) {
startCounter(a);
}
});
</script>
</body>
</html>
Example 1
C:\Users\Administrator\Documents\Lorem\index.html
C:\Users\Administrator\Documents\Lorem\style.scss


Example 2
Example 3

PreviousCreating a Countdown Timer, dakhoathienhoa.com.vn (oK)NextClick Button background-hover white (ok)
Last updated
Was this helpful?