Vertical Divs swapping well but the content of the corresponding divs overlaps or leave white space
<p>Swapping among vertically aligned divs within a parent container div are working fine; but after swapping the moving div accommodate at the new position only when the div already present here earlier has sufficient space; otherwise it overlaps the immediate next div. Similarly if the newly swapped div acquires a new position where the space occupied by the earlier div at this position is more, there is a white space left.</p>

<p>How can the overlapping and white spacings be avoided after swapping?</p>
