jQuery UI Draggable - Constrain movement
Constrain movement along an axis:
I can be dragged only vertically
I can be dragged only horizontally
Or to within another DOM element:
I'm contained within the box
I'm contained within the box's parent
I'm contained within my parent
Constrain the movement of each draggable by defining the boundaries of the draggable area. Set the axis
option to limit the draggable's path to the x- or y-axis, or use the containment
option to specify a parent DOM element or a jQuery selector, like 'document.'