Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dragdealer.js is not working in hide/show div #111

Open
qararulhassan opened this issue Jan 30, 2016 · 3 comments
Open

Dragdealer.js is not working in hide/show div #111

qararulhassan opened this issue Jan 30, 2016 · 3 comments

Comments

@qararulhassan
Copy link

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?

@mkawczynski07
Copy link

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

@agencyzed
Copy link

agencyzed commented Feb 13, 2017

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.

@ciskosv
Copy link

ciskosv commented Apr 12, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants