aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/ui.draggable.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/ui/ui.draggable.js b/ui/ui.draggable.js
index 469949199..da483bfaa 100644
--- a/ui/ui.draggable.js
+++ b/ui/ui.draggable.js
@@ -266,8 +266,8 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
];
- if(!(/^(document|window|parent)$/).test(o.containment)) {
- var ce = $(o.containment)[0];
+ if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) {
+ var ce = $(o.containment)[0]; if(!ce) return;
var co = $(o.containment).offset();
var over = ($(ce).css("overflow") != 'hidden');
@@ -277,6 +277,8 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - this.helperProportions.width - this.margins.left,
co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - this.helperProportions.height - this.margins.top
];
+ } else if(o.containment.constructor == Array) {
+ this.containment = o.containment;
}
},