mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
draggable: fixed using Array for containment option (fixes #3877)
This commit is contained in:
parent
59c6f97625
commit
bcda57c355
@ -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
|
($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
|
||||||
];
|
];
|
||||||
|
|
||||||
if(!(/^(document|window|parent)$/).test(o.containment)) {
|
if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) {
|
||||||
var ce = $(o.containment)[0];
|
var ce = $(o.containment)[0]; if(!ce) return;
|
||||||
var co = $(o.containment).offset();
|
var co = $(o.containment).offset();
|
||||||
var over = ($(ce).css("overflow") != 'hidden');
|
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.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
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user