From: kborchers Date: Thu, 12 May 2011 21:27:12 +0000 (-0500) Subject: Draggable: Changed logic to only subtract left and top offsets of containment if... X-Git-Tag: 1.9m5~27^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F266%2Fhead;p=jquery-ui.git Draggable: Changed logic to only subtract left and top offsets of containment if left and top are not already 0. Fixed #4838 - containment: 'document' is incorrect for top and left in draggable --- diff --git a/ui/jquery.ui.draggable.js b/ui/jquery.ui.draggable.js index d7bc09578..acc6c7bb3 100644 --- a/ui/jquery.ui.draggable.js +++ b/ui/jquery.ui.draggable.js @@ -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 ];