I was facing the issue mentioned in #15, which is that the slider doesn't seem to work if the slider is hidden when the page first loads. Wrapping the logic in _handleResize() with a setTimeout of 0 gives JS (with it's single-threaded nature) enough time to know what the new size of the element is if the previous height and width were 0.
I'm using these changes live on a minesweeper app. The repo lives here. The sliders appear if the client clicks on the "new game" button at the bottom of the screen.
I was facing the issue mentioned in #15, which is that the slider doesn't seem to work if the slider is hidden when the page first loads. Wrapping the logic in
_handleResize()
with asetTimeout
of 0 gives JS (with it's single-threaded nature) enough time to know what the new size of the element is if the previous height and width were 0.I'm using these changes live on a minesweeper app. The repo lives here. The sliders appear if the client clicks on the "new game" button at the bottom of the screen.