HubSpot / odometer

Smoothly transitions numbers with ease. #hubspot-open-source
http://github.hubspot.com/odometer/docs/welcome
MIT License
7.31k stars 716 forks source link

Better formatting #81

Open derrickpelletier opened 9 years ago

derrickpelletier commented 9 years ago

I feel like it should be possible to do something like $0,0 and have the $ be a part of the animation slide. If you just put a $ before the odometer and are transitioning down, the numbers roll to 0 and then disappear, causing the $ to jump over, which looks bad.

It would also be nice in this case if we could optionally set leading zero digits to animate to a blank character to avoid the disappearing digit.

komasoftware commented 9 years ago

I'm looking for exactly the same thing, displaying a monetary value. I would like the option keep showing 2 digits precision even if the number ends in ,00

ogarling commented 9 years ago

Thumbs up for this enhancement request for me as well.

KoltonG commented 9 years ago

This would be awesome to have +1. Any chance @zackbloom @adamschwartz @andrewreedy had a chance to look at this?

adamschwartz commented 9 years ago

@derrickpelletier We totally agree this would be a rad addition. And there have been some PRs along these lines. In the meantime, this CSS works pretty well for the specific thing you’re trying to accomplish:

.odometer .odometer-inside:before {
    content: "$"
}

jsFiddle

@komasoftware I believe that’s a duplicate of https://github.com/HubSpot/odometer/issues/96.

@KoltonG absolutely. Improving the formatting is definitely something we’re interested in doing. Just a matter of finding the time and figuring out the right approach to satisfy the various things people want to be able to do.

Hope this helps!