Search code examples
javascripthtmlcssdrag-and-dropdraggable

How to make draggable elements fit to div and not collapse on each other


So every time I drag and drop an element to a div two problems happen. 1. It doesn't fit to the div. 2. It collapses when I drag and drop one element so I need a way to keep the space the element used to take intact.

https://jsfiddle.net/1yy2u8qw/

$( ".selector" ).droppable({ tolerance: "fit" }); //is this correct?


Solution

  • It looks like you missed <table> and .drop have height:90px - so dragged into element will overflow it. Change to min-height:90px

    Here is the solution

    https://jsfiddle.net/1nrouva3/2/