Search code examples
jquerydraggablecontainsresizable

JQuery: Draggable div disappears when moved to new div and Resizable evoked


I have a draggable div with resizable east and west handles that is contained in a larger div and snaps to other divs.

This all works except for when I drag the div and let it snap to another div, when the resizable is evoked the draggable div dissapears.

If I drag the div to one of the other snapping divs then return it to the origination div I can resize and the div does not disappear.

I have a JS Bin for this: http://jsbin.com/xexutikeja/edit?html,css,js,output


Solution

  • Your containment in resizable doesn't match the one in your draggable, so it tries to set containment to original parent, but the element is over another div. Simply change your resizable for:

        $('#cat').resizable({
            handles: "e, w",
            containment: ".bigCat"
        })