JQuery Drag panel causing white margin to the right of the window

2731
2
Jump to solution
11-05-2015 10:57 AM
AlexGole
Occasional Contributor II

Hi all, I am using JQuery drag function to allow users to drag their panels around. It works great but I am experiencing some issues when dragged out of the document to the right. It seems like  it is causing a white margin to appear to the right of the window. Any idea? jsbin.

Capture.PNG

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
TyroneBiggums
Occasional Contributor III

Look into the properties available to the draggable functionality.

You have: $('.LayerDrag').draggable({});

Add constrainment like this: $('.LayerDrag').draggable({ constrainment: '#divName' });

'#divName' would be the container you want your draggable to stay within, like, your DOM element that you put your map in.

Note: For your QueryDrag element, you only have "draggable()". You'd need the {} to add draggable properties, like above.

https://jqueryui.com/draggable/#constrain-movement

View solution in original post

2 Replies
TyroneBiggums
Occasional Contributor III

Look into the properties available to the draggable functionality.

You have: $('.LayerDrag').draggable({});

Add constrainment like this: $('.LayerDrag').draggable({ constrainment: '#divName' });

'#divName' would be the container you want your draggable to stay within, like, your DOM element that you put your map in.

Note: For your QueryDrag element, you only have "draggable()". You'd need the {} to add draggable properties, like above.

https://jqueryui.com/draggable/#constrain-movement

AlexGole
Occasional Contributor II

Thanks! That is it!

0 Kudos