dragdealer icon indicating copy to clipboard operation
dragdealer copied to clipboard

Dragdealer.js is not working in hide/show div

Open qararulhassan opened this issue 10 years ago • 3 comments

I put the drag Dealer in a div that is hidden by css (display:none), then when i show the div through jquery (.show()) the div shows the slider but it doesnt Drag.

No error in de firebug console.

any ideas?

qararulhassan avatar Jan 30 '16 15:01 qararulhassan

The same problem in my test case. Slider wrapper at the beginning is hidden(display: none).

mkawczynski07 avatar Apr 14 '16 11:04 mkawczynski07

I see the same issue using sliders in an accordion. Resizing the browser seems to init the slider but the drag element is not at the start.

agencyzed avatar Feb 13 '17 22:02 agencyzed

I know this is an old issue by now, but wasn't able to find any solution but found the solution. The problem is in the function 'calculateBounds' in dragdealer.js, as it try to get the offsetWidth of your hidden element, as it's is hidden the element doesn't 'exist' to the function, so it put the default value of '0' (zero). The solution I found out is to make the element visible at the beginning of calculateBounds function and then, before the "return bounds' line, hide the element again (or in my case, as the hide/show behavior is dynamic, I put a variable/flag to determinate if it has to keep the element shown or hide it again... hope it make sense. Another solution that might apply is to clone the hidden element, append it to the body, get the offsetHeight of the new element, then detach it.

ciskosv avatar Apr 12 '17 19:04 ciskosv