I am using jQuery UI to create a draggable <div> . <div> absolutely positioned in the lower right or upper left corner using CSS:
.dragbox { position: absolute; width: 140px; min-height: 140px; border: 3px solid black; padding: 10px; } .bottom { bottom: 5px; right: 5px; } .top { top: 5px; left: 5px; }
HTML looks like this:
<div class="dragbox bottom"> Bottom Box :( </div> <div class="dragbox top"> Top Box :) </div>
JavaScript $('.dragbox').draggable(); allows you to make <div> elements draggable. The top left <div> works as expected, but the bottom right <div> resizes when you drag it. If I change the min-height poperty .dragbox to height , I will see the expected behavior for both fields, but for this I need to use min-height because I donβt know the length of the inner content.
How to position the <div> in the lower right corner and allow drag and drop without resizing the <div> when dragging? Elements of the upper and lower right <div> should behave identically.
DEMO (I use Chrome 27 and Safari 6)
source share