Breck Fresen
Breck Fresen

Reputation: 295

Non-uniform snap interval on flex slider?

I'm currently using the Flex HSlider control. I'd like the slider to only allow the user to pick the values: [0, .5, 1, 2]

I can get it close to what I want by setting the snapInterval to .5 and by explicitly providing the tickValues. But that still allows the value 1.5 to be selected. Is there a way to provide explicit snapValues or to only allow entries in tickValues to be selected? Or do I have to roll my own slider?

Thanks in advance,

-- Breck

Upvotes: 0

Views: 902

Answers (1)

Dmitry Miller
Dmitry Miller

Reputation: 26

You need to extend spark.components.HSlider. You would have to set the snapInterval to 0 and override nearestValidValue function. In your implementation you should "round" the value to one of your your snap values (i.e. 0.5,1,2)

Thanks,

--- Dmitry

Upvotes: 1

Related Questions