HubSpot / odometer

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

Use 'D' symbol in format to specify minimal length of fractional part #84

Open iogorodov opened 9 years ago

iogorodov commented 9 years ago

This request address issues #45 and #63 (as far as I understand this issues duplicate each other). Now it's possible to specify minimal length of fractional part using 'D' symbol. At the same time 'd' symbol used to specify maximal length as it works in current version.

Here some examples how format works. Assume that value is 1.23:

Look for live sample in trailing-zero.html file in test folder

zefrench commented 9 years ago

Thank you very much for solution !! It looks great !! But do you have a solution to put "€" just after the number ? Thank you again. Best Regards.

iogorodov commented 9 years ago

I use :before and :after css selector to out currency's symbol. I.e.

<span class="eur odometer" id="eur_value"></span>
.eur:before {content: "\20AC\00A0";}

And then set value to span via textContent

zefrench commented 9 years ago

Thanks again ! But where do I have to call on this class Euro cos I'm using this script ? I create the class and call it with : class="eur" but the class is not called Here is the file

zefrench commented 9 years ago

Finally, the class is now loaded but the price is placed under the Euro sign. I don't understand cos there is no breakline... The result is like that : € 180,250

iogorodov commented 9 years ago

I've add follow lines to the bottom of my odometer's theme file:

.odometer-inside {
  display: inherit;
}

I'm not sure about correctness of this solution and you cat try replay display: block in odometer's theme

zefrench commented 9 years ago

Ok. Thank you ! Perfect ;-)