Draggable demo: Fixed containment option.

This commit is contained in:
Scott González 2012-01-22 14:55:09 -05:00
parent 509a3a673c
commit 91bf052d81

View File

@ -71,8 +71,8 @@
bottom = top + container.height();
function drag( event, ui ) {
var leftDiff = ui.startOffset.left + ui.startPosition.left,
topDiff = ui.startOffset.top + ui.startPosition.top;
var leftDiff = ui.startOffset.left - ui.startPosition.left,
topDiff = ui.startOffset.top - ui.startPosition.top;
ui.position.left = Math.max( ui.position.left, left - leftDiff );
ui.position.left = Math.min( ui.position.left,