paveltyavin / multirangeslider

Slider for timetable and more
http://paveltyavin.github.io/multirangeslider/
MIT License
20 stars 6 forks source link

Doesn’t seem to draw correctly after calling add() #5

Closed jameshoward closed 8 years ago

jameshoward commented 8 years ago

I have created a slider and tried to add a range with add([10, 20]. The range gets added but it's left position and width are both 0 until I start dragging, when it jumps to the right position.

var slider = new MultiRangeSlider({
    min: 0,
    max: 100,
    step: 1
});
document.body.appendChild(slider);
slider.add([10, 20]);
paveltyavin commented 8 years ago

Can you make a screen shot of a problem here https://jsfiddle.net/paveltyavin/qsgtyxkm/1/ ?

jameshoward commented 8 years ago

Ah, I think I may have realised what the problem is. The slider element is being added to a hidden element so presumably its width is 0 and then the calculations for the width / left are failing then I show it and it appears broken. If I don't hide the container it works fine. I will close the issue, thanks for your help.