Created
January 9, 2018 10:17
-
-
Save l4ci/66a749097dda81102521c6a1695a3206 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
// <div class="counter" data-count="150">0</div> | |
$('.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); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment