12345
Fork me on GitHub

I wanted create a CSS animated reel of numbers so wrote this little plugin. Animation can be initalized programatically el.numberReel or using data-attributes data-trigger="numberReel". At the time of writing the plugin take thes following options

191919
<div data-trigger="numberReel">191919</div>

292929
$('.number').numberReel({
    infinite:true
});

9999999
<div data-trigger="numberReel" data-thousands="true" data-currency="£">9999999</div>

##onClick

you can click me multiple times
var btn = $('[data-trigger="clickme"]');
var numbers = $('#onClick');

btn.on('click', function(){
    var number = Math.floor(Math.random() * 9999);
    numbers.html(number).numberReel();
});

##Options

name type default description
wrapper string 'number-reel' wrapping div.class
currency string '$' Prepend a currecy symbol or any string. '', prepends NULL
infinite boolean false true animates the numbers continuously with the addition of .infinite, a small delay is present which is configurable in the CSS. false animates only once.
thousands boolean false groups numbers reels in 3's to add styling for thousand seperated numbers. i.e 1 000 000


blog comments powered by Disqus