Unknown Error
Unknown Error

Reputation: 797

How do I stop jQuery ui draggable if current move is over picture height size?

Here an example http://jsfiddle.net/7aVXc/

Let' say current image height is 400px.

How do I stop the image when the white background is appear on top and bottom?

Upvotes: 0

Views: 164

Answers (1)

scessor
scessor

Reputation: 16115

E.g. add a drag-handler which returns true or false relative to the vertical position:

$("#image").draggable({
    ...
    drag:function(event,ui) {
        return (ui.offset.top > -235 && ui.offset.top < 15);
    }
});

Also see this example.

Upvotes: 1

Related Questions