Created
October 19, 2022 22:37
-
-
Save louisesalas/3bc945cf1694f770e7447517dfadd682 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(window).scroll(function(){ | |
var a = 0; | |
var oTop = $(".counter-container").offset().top - window.innerHeight; | |
if (a == 0 && $(window).scrollTop() > oTop) { | |
$('.number-title').each(function () { | |
var $this = $(this); | |
jQuery({ Counter: 0 }).animate({ Counter: $this.attr("data-counter") }, { | |
duration: 2000, | |
easing: 'swing', | |
step: function () { | |
var sign_ = $this.text(); | |
var suffix = ( !FX.CounterJS.isNumber( sign_ ) ) ? sign_ : ''; | |
$this.text(Math.ceil(this.Counter).toLocaleString() + sign_.substring(sign_.length - 1)); | |
} | |
}); | |
}); | |
a = 1; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment