0

I have an animated counter that counts up some number. It works good with a decimal and looks like this: 111.90. But I need to show the number with a comma instead of dot, like this 111,90. How can I replace the dot but to save the counter effect? Here is the code:

$('.animate-math .number').waypoint({

offset      : '100%',
handler     : function(){

        var el          = $( this.element );
        var duration    = Math.floor( ( Math.random() * 1000 ) + 1000 );
        var to          = el.attr( 'data-to' );

        $({ property:0 }).animate({ property:to }, {
            duration    : duration,
            easing      :'linear',
            step        : function() {
                el.text( Math.floor( this.property ) );
            },
            complete    : function() {
                el.text( this.property );
            }
        });

        if( typeof this.destroy !== 'undefined' && $.isFunction( this.destroy ) ){
            this.destroy();
        }
    }
});
Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
passwd
  • 2,883
  • 3
  • 12
  • 22

0 Answers0