In the drag event, the ui hash contains a position property. You can
modify the values of the left and top properties of ui.position to
change where the element will be positioned.
For example, to force an element to always have its top at 200px you
could do:
$(el).draggable({
drag: function(event, ui) {
ui.position.top = 200;
}
});
You can implement your custom logic for containing your element using
this method.
On Sep 10, 3:10 am, David Zentgraf <[email protected]> wrote:
> Hi,
>
> I'm using the jQuery UI Draggable behavior and am looking for
> "reverse" containment options. I want to be able to drag an image
> inside a parent which has "overflow: hidden". The image is the same
> size as or bigger than the parent, i.e. it always fills it completely.
> When dragging, I want the image to continue to fill the parent. I.e.
> the left image offset should always be <= the left parent offset, the
> right image offset always >= parent right offset etc.
>
> Is there a way to do this with the current Draggable?
>
> Chrs,
> Dav
>
> PS: +1 for this:http://dev.jqueryui.com/ticket/4145
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---