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

Currency Symbol in front of number #100

Closed kyoukhana closed 9 years ago

kyoukhana commented 9 years ago

Is is possible to put a dollar sign in front of the number. If so how.

julian-weinert commented 9 years ago

Generally it would be nice to be able to append / prepend strings that don't get animated. Also animating strings (like on the website) would be amazing also, probably with randomized mixed characters of the string...

thesublimeobject commented 9 years ago

I third this.

KoltonG commented 9 years ago

+1 for this feature @zackbloom @adamschwartz @andrewreedy

adamschwartz commented 9 years ago

This can be solved with just a little CSS:

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

jsFiddle

KoltonG commented 9 years ago

@adamschwartz I am having hard time understanding the codebase to see if I can change it. But a simple thought would be that whenever the update is called and it renders the appropriate lenght, couldn't you also call

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

but if the length of the new number added another 0 then take off the prefix 0?

.odometer .odometer-inside:before {
    content: "$0"
}
adamschwartz commented 9 years ago

@KoltonG please see https://github.com/HubSpot/odometer/issues/91#issuecomment-137845693 and https://github.com/HubSpot/odometer/issues/81#issuecomment-137844322 for responses to the issues brought up here.