HTML markup
1 2 3 4 5 6 |
<section class="ct-counters"> <div class="ct-counter-to"> <h5 class="ct-counter-to__header"><i class="fa fa-trophy"></i>Awards Won</h5> <div class="ct-counter-to__number"><span data-from='0' data-to='365' data-speed='5000' class="ct-counter-to-number ct-js-counter">0</span></div> </div> </section> |
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
$('.ct-counters').each(function(){ var that = $(this), counter = that.find('.ct-js-counter'); if(that.visible(true)){ /*CountTo */ if ($().countTo) { counter.each(function() { $(this).countTo(); }); } }else{ if ($().countTo) { counter.each(function() { $(this).countTo("restart"); }); } } }); |
Screenshot