Skip to content
This repository has been archived by the owner on Apr 2, 2019. It is now read-only.

Support for leading (and trailing zeroes) #88

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

mikaelhm
Copy link

continued on the work of @iogorodov ( he added trailing zeroes) by adding support for leading zeroes, through the option of setting minimal integer length.

This fixes #67 and #63.

@bjmiller121
Copy link

+1

@adamschwartz
Copy link
Contributor

Sweet

@barlindhaug
Copy link

Looks nice!

Are there any reasons this isn't merged yet, @adamschwartz ?

@julian-weinert
Copy link

@mikaelhm The minIntegerLen option does not work at all. When setting minIntegerLen to, for example, 6 and update to a value, for example 97, I'm just getting two digits.

Can you please confirm and fix this?

@mikaelhm
Copy link
Author

@julian-weinert it's been a while since i wrote this. can you paste the code you're using somewhere, and i can try to take a look at it.

@adamschwartz
Copy link
Contributor

@barlindhaug haven’t had the chance to play with it. Plus I’ve mostly handled the CSS for the project.

@zackbloom any thoughts?

@barlindhaug
Copy link

@adamschwartz Ok, I see. Thanks for getting back to me!

@julian-weinert
Copy link

@mikaelhm I see, it has been in loop for a while... I created a fiddle for you: https://jsfiddle.net/julian_weinert/55wv6vnL/3/

@mikaelhm
Copy link
Author

mikaelhm commented Jul 5, 2015

@julian-weinert, it does work.

The problem in your jsfiddle is that when you use the class odometer on the span element, an odometer will automatically be created for your number, which has no minIntegerLen option set. You might notice that you're value 100 is ignored as well. The js code will instantiate a new odometer on the same element which is ignored.

To fix it rename the span class:
https://jsfiddle.net/jgepmvug

Or disable the auto feature to off like this:

window.odometerOptions = {
  auto: false
}

For more details see the docs:
http://github.hubspot.com/odometer/

@julian-weinert
Copy link

My fault, I should have seen this myself...
Thanks, @mikaelhm, now works indeed – awesome!

@lexi-lambda
Copy link

👍 any reason this isn't merged yet?

@mikaelhm
Copy link
Author

Don't think so. Not sure who can merge it.
On Tue 28 Jul 2015 at 17:07, Alexis King notifications@github.com wrote:

[image: 👍] any reason this isn't merged yet?


Reply to this email directly or view it on GitHub
#88 (comment).

@ghost
Copy link

ghost commented Jul 30, 2015

Hey folks,

It's really cool that you've made those changes to provide such a functionality.
Unfortunately, I encountered an issue that exists in original HubSpot's code too and inherited by your code.

The issue revealed as wrong least digit behavior. The odometer somethimes shows "value+1" when stopped, also sometimes the dot appears in last digit position in the right bottom corner.

More details can be found here #97 (example uses original code: http://jsfiddle.net/vdLe9y95/7/). I also made an offline example (http://nekaka.com/d/RFqOB8Sr2Q) that uses the odometer from this repo: https://github.com/mikaelhm/odometer. Look into those examples for a couple of minutes and you will see what I'm talking about.

Sorry for offtopic, I can't post the issue to your forked repos, due to "issues" button disabled.

Thanx in advance.

@mikaelhm
Copy link
Author

mikaelhm commented Aug 3, 2015

@4xy you're right. There was a rounding error.

I have now fixed it.

@mikcox
Copy link

mikcox commented Aug 5, 2015

+1 for this fix. Can we get this merged? :D

@romanzubenko
Copy link

Hey guys, any updates on when this can be merged?

@ghost ghost mentioned this pull request Sep 1, 2015
@adamschwartz
Copy link
Contributor

For all interested, please see #106 for a workaround.

@saurabhj
Copy link

Works brilliantly! Thank you so much!

@adamschwartz
Copy link
Contributor

No problem @saurabhj :)

@eduardoscamargo
Copy link

Thanks! It was very useful here. Works perfectly.

@KroniKZA
Copy link

Hey,

If I kicked off a count up, then hide the div its contained in using fadeOut (effectively display none) and then fade it back in, the odometer is no longer counting up, but showing the final result. This is obviously with a high transition time. Is there a workout around to make it keep doing the count up after fadeOut?

Thanks

@robgraeber
Copy link

+1 for merging

@loowernsheng
Copy link

loowernsheng commented Jul 12, 2016

0.0X is not working. It will will 00X without decimal point. Can help?

@valtido
Copy link

valtido commented Sep 26, 2016

still no merge?

@liteylgay
Copy link

Thanks so much for your compiled version! It works as a charm.

@arkabhowmik
Copy link

arkabhowmik commented Dec 28, 2017

Ok, first of all, thank you for the requested feature. This should have been merged by now. However, I think I have come across an issue.

The decimal zeros do not animate when using "count" animation option. It only works on the slide option. Can test in the provided jsfiddle by the dev.

Shoutout @mikaelhm

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

Successfully merging this pull request may close these issues.

Padding with zeroes