diff options
author | Paul Bakaus <paul.bakaus@googlemail.com> | 2009-01-20 10:01:49 +0000 |
---|---|---|
committer | Paul Bakaus <paul.bakaus@googlemail.com> | 2009-01-20 10:01:49 +0000 |
commit | bcda57c355a7e227999ef1286130330ceb7ad6a3 (patch) | |
tree | 7a73b954947a9942714c649a1f5565376ec719ec /ui | |
parent | 59c6f97625cf6f149af7543b1739aa8d22737e6e (diff) | |
download | jquery-ui-bcda57c355a7e227999ef1286130330ceb7ad6a3.tar.gz jquery-ui-bcda57c355a7e227999ef1286130330ceb7ad6a3.zip |
draggable: fixed using Array for containment option (fixes #3877)
Diffstat (limited to 'ui')
-rw-r--r-- | ui/ui.draggable.js | 6 |
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; } }, |