HTML markup
1 2 3 |
<div class="col-md-4 col-sm-4"> <div class="ct-counterBox"><span class="ct-counterBox-icon"><img src="../assets/images/demo-content/delimondo/fork-icon-small.png" alt="Image"></span><span data-ct-to="13520" data-ct-speed="9000" class="ct-counterBox-number ct-js-counter">13 520</span><span class="ct-counterBox-title">plates served</span></div> </div> |
JavaScript
This code can be find in the {Theme} main.js file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
// Counters // ------------------------------------------------------------------------------------------------------------------------------------------ /* ================== */ /* ==== COUNT TO ==== */ if (($().countTo) && ($().appear) && ($("body").hasClass("cssAnimate"))) { $('.ct-js-counter').data('countToOptions', { formatter: function (value, options) { return value.toFixed(options.decimals).replace(/\B(?=(?:\d{3})+(?!\d))/g, ' '); } }).appear(function () { $(this).each(function (options) { var $this = $(this); var $speed = validatedata($this.attr('data-speed'), 1400); options = $.extend({}, options || { speed: $speed }, $this.data('countToOptions') || {}); $this.countTo(options); }); }); } else if(($().countTo)){ $('.ct-js-counter').data('countToOptions', { formatter: function (value, options) { return value.toFixed(options.decimals).replace(/\B(?=(?:\d{3})+(?!\d))/g, ' '); } }); $('.ct-js-counter').each(function (options) { var $this = $(this); var $speed = validatedata($this.attr('speed'), 1200); options = $.extend({}, options || { speed: $speed }, $this.data('countToOptions') || {}); $this.countTo(options); }); } |