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

Comma formatter for external js file #71

Open
originalorange opened this issue Feb 14, 2018 · 1 comment
Open

Comma formatter for external js file #71

originalorange opened this issue Feb 14, 2018 · 1 comment

Comments

@originalorange
Copy link

Apologies, I know you've been over this many times, but I can't seem to find an example like mine. I am using an external js file to call countTo which pulls the "to" value from the html (.count-number). I am trying to include the custom formatter to add the commas but I can't get it to work. Here is what I currently have:

function initCounters(){
$(".count-number").appear(function(){
var count = $(this);
count.countTo({
from: 0,
to: count.html(),
speed: 1300,
refreshInterval: 60,
formatter: function (value, options) {
value = value.toFixed(options.decimals);
value = value.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
return value;
}
});
});
}

What am I doing wrong? Needless to say I am a total novice and appreciate any assistance!

@MainBorda
Copy link

Hi @originalorange , did you found the solution about this? Need it so hard

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

2 participants