Skip to content

Support floating point numbers #190

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

Closed
goldenram opened this issue Dec 4, 2015 · 7 comments
Closed

Support floating point numbers #190

goldenram opened this issue Dec 4, 2015 · 7 comments

Comments

@goldenram
Copy link

This is a great slider implementation, just need support added for floating point numbers and decimal precision. Use case would be the ability to set the min, max and values to numbers like -2.056 or 3.1.
Also it would be good when implementing this to allow one to specify the number of decimal places to show, for example show 2.1 or 2.109.

@ValentinH
Copy link
Member

This is already possible using the step and precision options! ;)
There you go: http://jsfiddle.net/mhc4cx0h/ .

@goldenram
Copy link
Author

Sorry, it appears to sometime work, using the demo page I see this, which is why I thought it was not supported. I see NaN when setting the step to .1 and precision to 2.

slidernan

@ValentinH
Copy link
Member

Indeed, changing it in the all options demo can lead to weird behaviour. This might not be the best example ever! :D Step and precision must always have compatible values in order to have a working slider.

@goldenram
Copy link
Author

Ah, ok, so the key is getting the step and precision compatible. Do you have a range example handy? I must keep running into the step and precision issues.

@ValentinH
Copy link
Member

Sure, there you go: http://jsfiddle.net/gnp572dv/ .

@goldenram
Copy link
Author

Thanks Valentin! I do notice that if the numbers are less than 0 they are rendered incorrectly.
For example:

minValue: -2.002,
maxValue: -1.002,
options: {
  floor: -5.000,
  ceil: -1.000,
  step: 0.001,
  precision: 3

}

Those numbers render off by .001 in the fiddler. Can you confirm? or did I set something up wrong?

@ValentinH
Copy link
Member

Indeed, there is a bug. Can you fill an issue please? I'll have a look tomorrow.
Demo: http://jsfiddle.net/7bbf78op/

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