IonDen / ion.rangeSlider

jQuery only range slider
http://ionden.com/a/plugins/ion.rangeSlider/en.html
MIT License
2.56k stars 508 forks source link

Grid values aren't rounded #760

Open hetzner opened 3 years ago

hetzner commented 3 years ago

The grid values should be rounded to avoid display like this: grafik

$(".js-range-slider").ionRangeSlider({
    type: "double",
    skin: "round",
    grid: true,
    grid_num: 4,
    min: -39.90,
    max: 111.00,
    from: -39.90,
    to: 111.00
});
hetzner commented 3 years ago

Same issue occurs when moving the slider: grafik

Additional note: In this example the issue occurs for all values between -16 and 16. For all values outside this range the values (grid marks and current values) are rounded correctly.

JSFiddle Test Case: https://jsfiddle.net/tjubx43m/

IonDen commented 3 years ago

Hi, this is how division works on computers :) But you could fix precision using step attribute.

Example: https://jsfiddle.net/IonDen/thcen42d/