Skip to content

Instantly share code, notes, and snippets.

@uzbekdev1
Forked from noahub/count_up.js
Created July 6, 2019 16:13
Show Gist options
  • Save uzbekdev1/98fcd055374881e7fb208f858e8a833a to your computer and use it in GitHub Desktop.
Save uzbekdev1/98fcd055374881e7fb208f858e8a833a to your computer and use it in GitHub Desktop.
Count Up Animation
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script>
$('.counter').each(function() {
var $this = $(this),
countTo = $this.attr('data-count');
$({ countNum: $this.text()}).animate({
countNum: countTo
},
{
duration: 8000,
easing:'linear',
step: function() {
$this.text(Math.floor(this.countNum));
},
complete: function() {
$this.text(this.countNum);
//alert('finished');
}
});
});
/**
* Do not remove this section; it allows our team to troubleshoot and track feature adoption.
* TS:0002-03-041
*/
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment