Skip to content

Instantly share code, notes, and snippets.

@pomartel
Created October 10, 2013 13:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pomartel/6918731 to your computer and use it in GitHub Desktop.
Save pomartel/6918731 to your computer and use it in GitHub Desktop.
Petit coffeescript pour animer un chiffre de 0 jusqu' à son total
#counter{ data: { total: 143 } } 0
$ ->
if $('#counter').length > 0
animateCounter
animateCounter = ->
current = parseInt($('#counter').text())
if current < $('#counter').data('total')
$('#counter').text(current + 1)
setTimeout animateCounter, 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment