Sliders use DOM position offsets to calculate value. The initial offsets are calculated at instantiation. If the Slider is instantiated in a hidden container, the initial offsets are stored as NaN
, resulting in all further calculations returning NaN
.
There are three methods to create Sliders with functional offset calculations:
resetConstraints
method and the Slider's setStartSliderState
when the container is displayedverifyOffset
method to account for incorrectly initialized offsetsEach of these approaches has its drawbacks (noted in the code below).
DualSlider additionally needs some code patches to facilitate correcting its reference values (for options #2 and #3).
Caveat: Attempts to getValue
or setValue
will still fail (return NaN
) as long as the Slider is not displayed.