Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No commas, how to add? #2

Open
Jolva opened this issue Oct 13, 2016 · 2 comments
Open

No commas, how to add? #2

Jolva opened this issue Oct 13, 2016 · 2 comments

Comments

@Jolva
Copy link

Jolva commented Oct 13, 2016

Hello. We're using this script to display large numbers (billions, millions, etc). There doesn't seem to be an easy way to display commas in the number during/after the animation. Is this possible?

@voitin
Copy link

voitin commented Jun 12, 2018

Yes it is, change the numberRoll function to this:

function numberRoll(slno,min,max,increment,timeout){
        if(min<=max){
            $('.roller-title-number-'+slno).html(String(min).replace(/(.)(?=(\d{3})+$)/g,'$1,'));
            min=parseInt(min)+parseInt(increment);
            setTimeout(function(){numberRoll(eval(slno),eval(min),eval(max),eval(increment),eval(timeout))},timeout);
        } else {
			
            $('.roller-title-number-'+slno).html(String(max).replace(/(.)(?=(\d{3})+$)/g,'$1,'));
        }
}

@rajeshworkz
Copy link

Thank you @voitin you saved my life

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants