JqueryUI Draggable - Auto resize parent container?

Here you go. Works both horizontally and vertically. See it in action at jsfiddle.net/evunh/1.

Here you go. Works both horizontally and vertically. See it in action at jsfiddle.net/evunh/1/ var I = $('#inner'); var o = $('#outer'); i.

Draggable({ drag: function(ui, event) { if (i.position(). Top > o.height() - i.height()) { o. Height(o.height() + 10); } if (i.position().

Left > o.width() - i.width()) { o. Width(o.width() + 10); } } }).

! For a working demo; albeit it only deals with one of the four edges. But a good start.

:) – David Thomas Feb 17 at 1:36 @david Thomas, That's the concept behind drag auto re-size. The same can be done horizontally by using left position and width. – Hussein Feb 17 at 1:43 Well, yes: obviously.

Which is why I up-voted. The comment was merely to suggest that you might be able to go a little further, to help the OP out. It wasn't, at least, intended as a criticism =) – David Thomas Feb 17 at 2:16 @david Thomas, Ok I got you.

Here you go. Jsfiddle. Net/evunh/1.

Also updated the code above. :-) – Hussein Feb 17 at 2:23 1 @Richard Make sure you accept the answer if this solution works for you. – Hussein Feb 17 at 8:35.

You can use the drag function that comes with jquery draggable. In the drag function you can just check if the edges of the inner div is outside of the container div's edges. If thay are, increase the width or height of the container div.

You can use the position method that is native in jquery ui to check for positions of top,bottom,left and right of both div tags. Here are links to the api for more detailed information about how these methods work. Draggable->event->drag Position.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions