Establish draggable content constraints depending on position

Posted by drukelly on Stack Overflow See other posts from Stack Overflow or by drukelly
Published on 2010-03-11T20:09:27Z Indexed on 2010/03/11 20:14 UTC
Read the original article Hit count: 501

Filed under:
|
|

Asking all jQuery experts!

How would I go about setting up constraints for a draggable element depending on its positioning? I have a basic example here. I thought it would be as simple as adding an option, containment.

Ideally, I want it to drag within the following box:

top: 0px
left: 0px

top: -263px
left: -272px

top: 0px
left: -272px

top: -263px
left: 0px

Is there a way to drag the element within the parameters above so you don't the extra white space? I appreciate the help!

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-ui