Dragging and dropping a container moves left or up

Is there a good way for a div container to expand left and up when the draggable is dragged outside its borders?

When dragging right or down, the div container expands correctly, and scrollbars appear as needed. However, moving left or up means that the dragged items have a negative top / left position, so the container does not expand.

Here's a script demonstrating the existing drag and drop behavior: http://jsfiddle.net/NPC42/Un23w/1/ , but this can also be seen on official jQueryUI demos (http: .// jqueryui.com/demos/draggable/#default)

I would like to be able to expand the top / left too :)

The brute-force approach will be as follows:

  • Reset all the positions of the object on the div container so that there are no negative top / left (including the dragged object).
  • Change the scroll position so that it looks as if the objects are still in place.

But for many objects in the container, this can cause a lot of flicker or even slowdown, so I really do not want to go in that direction. Any suggestions are welcome!

+3
source share
1 answer

, html (0,0) . , dragable . , .

, (0,0). , . , , .

+1

All Articles