Skip to content
Permalink
Browse files

draggable: fixed using Array for containment option (fixes #3877)

  • Loading branch information
Paul Bakaus
Paul Bakaus committed Jan 20, 2009
1 parent 59c6f97 commit bcda57c355a7e227999ef1286130330ceb7ad6a3
Showing with 4 additions and 2 deletions.
  1. +4 −2 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;
}

},

0 comments on commit bcda57c

Please sign in to comment.
You can’t perform that action at this time.