Skip to content

Commit

Permalink
Draggable: Changed logic to only subtract left and top offsets of con…
Browse files Browse the repository at this point in the history
…tainment if left and top are not already 0. Fixed #4838 - containment: 'document' is incorrect for top and left in draggable

(cherry picked from commit 6e6d0b7)
  • Loading branch information
kborchers authored and scottgonzalez committed May 13, 2011
1 parent 427f3d4 commit 1866905
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ui/jquery.ui.draggable.js
Expand Up @@ -355,8 +355,8 @@ $.widget("ui.draggable", $.ui.mouse, {
var o = this.options;
if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
if(o.containment == 'document' || o.containment == 'window') this.containment = [
(o.containment == 'document' ? 0 : $(window).scrollLeft()) - this.offset.relative.left - this.offset.parent.left,
(o.containment == 'document' ? 0 : $(window).scrollTop()) - this.offset.relative.top - this.offset.parent.top,
o.containment == 'document' ? 0 : $(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
o.containment == 'document' ? 0 : $(window).scrollTop() - this.offset.relative.top - this.offset.parent.top,
(o.containment == 'document' ? 0 : $(window).scrollLeft()) + $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
(o.containment == 'document' ? 0 : $(window).scrollTop()) + ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
];
Expand Down

0 comments on commit 1866905

Please sign in to comment.