javascript - jQuery Round Slider add shorthand values to range -
i'm using round slider in application slider type range. range varies 0-2 million. have requirement if value above 1000, should represented such 1k (1200 1.2k), , if value above 1000000, should represented such 1m (1200000 1.2m). far not find way this.
if there way this?
thanks in advance
you can use tooltipformat property achieve behaviour
html
<div id="slider"></div>
js
window.formatter = function(e) { if (e.value >= 1000000) { return math.round(e.value / 100000) / 10 + "m"; } if (e.value >= 1000) { return math.round(e.value / 100) / 10 + "k"; } return e.value; } $("#slider").roundslider({ slidertype: "min-range", value: 45, max: 2000000, tooltipformat: "formatter" });
Comments
Post a Comment