-
Notifications
You must be signed in to change notification settings - Fork 386
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
contained draggies wont stay in container on container resize #34
Comments
I have ran into this issue also. I think the expected behavior should be to keep the elements contained on resize. |
Hmm, I understand the problem, but I kind of feel like this is on the border of Draggabilly's functionality. I'm considering adding a separate add-on script that would support this feature. Add a 👍 reaction to this issue if you would like to see this feature added. Do not add +1 comments — They will be deleted. |
That would be awesome! |
I should add a |
+1 |
i really need this functionality.. any solution got implemented yet ?? |
maybe set the position ofthe draggable item by using |
I tried to call the methods inside a 'dragStart' and 'pointerUp' to recalculate, but not work. |
I created an workahound: function FctAdjustTop(box) {
This code set to bottom all box without conteintment |
I've made this workaround for keeping the draggable inside the window when resizing const $draggable = document.querySelector('.side-button');
const draggie = new Draggabilly($draggable, {
containment: 'body',
});
window.onresize = () => {
const { top, left, height, width } = $draggable.getBoundingClientRect();
const windowBottomCoordinate = window.scrollY + window.innerHeight;
const windowRightCoordinate = window.scrollX + window.innerWidth;
draggie.setPosition(
left > windowRightCoordinate ? windowRightCoordinate - width : left,
top > windowBottomCoordinate ? windowBottomCoordinate - height : top
);
}; |
hello,
i am trying to have a contained drag experience for elements with a possible change of the container size. draggies will ignore that and not stay contained.
initial position is achived with left: 100%; and -30px; on a 30px whide box.
which is achiving the expected behaviour initially but is ruined once you start dragging then proceed changing size of the container…
http://jsfiddle.net/LPLXw/2/
do u think this would be a expected behaviour?
The text was updated successfully, but these errors were encountered: