aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.draggable.js
diff options
context:
space:
mode:
authorJean-Francois Remy <jfremy@virtuoz.com>2010-12-01 15:31:59 -0500
committerScott González <scott.gonzalez@gmail.com>2010-12-01 15:31:59 -0500
commite01664a3820c185636a3fe7099e93e68091d24fd (patch)
tree2ce97da0f31ca565401450f5162a02b1a4c22f14 /ui/jquery.ui.draggable.js
parenteac910f3157af42c7fcd2230aaff8508974ecc9a (diff)
downloadjquery-ui-e01664a3820c185636a3fe7099e93e68091d24fd.tar.gz
jquery-ui-e01664a3820c185636a3fe7099e93e68091d24fd.zip
Draggable: Handle scrolled windows. Fixes #6181 - Draggable: issue with containment on position:fixed elements.
Diffstat (limited to 'ui/jquery.ui.draggable.js')
-rw-r--r--ui/jquery.ui.draggable.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/ui/jquery.ui.draggable.js b/ui/jquery.ui.draggable.js
index 71698a85d..8eeaf6120 100644
--- a/ui/jquery.ui.draggable.js
+++ b/ui/jquery.ui.draggable.js
@@ -333,10 +333,10 @@ $.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 = [
- 0 - this.offset.relative.left - this.offset.parent.left,
- 0 - this.offset.relative.top - this.offset.parent.top,
- $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
- ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.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
];
if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) {