aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Bakaus <paul.bakaus@googlemail.com>2008-09-16 10:38:12 +0000
committerPaul Bakaus <paul.bakaus@googlemail.com>2008-09-16 10:38:12 +0000
commitb08ae847bf20721545cec87e6e08aa4c3a51d0a8 (patch)
treeecf1e5f254ce198492a7d9c255605e7224546e09
parentfe73615204227f177a2dcf54a6e10d2e47fd5505 (diff)
downloadjquery-ui-b08ae847bf20721545cec87e6e08aa4c3a51d0a8.tar.gz
jquery-ui-b08ae847bf20721545cec87e6e08aa4c3a51d0a8.zip
core: hasScroll now checks for overflow hidden, since then the users wants scroll to be hidden
draggable: containment respects overflow hidden (fixes #3328)
-rw-r--r--ui/ui.core.js4
-rw-r--r--ui/ui.draggable.js5
2 files changed, 7 insertions, 2 deletions
diff --git a/ui/ui.core.js b/ui/ui.core.js
index 9275c5fc1..b7e89b37e 100644
--- a/ui/ui.core.js
+++ b/ui/ui.core.js
@@ -283,6 +283,10 @@ $.ui = {
.unbind('selectstart.ui');
},
hasScroll: function(e, a) {
+
+ //If overflow is hidden, the element might have extra content, but the user wants to hide it
+ if ($(e).css('overflow') == 'hidden') { return false; }
+
var scroll = (a && a == 'left') ? 'scrollLeft' : 'scrollTop',
has = false;
diff --git a/ui/ui.draggable.js b/ui/ui.draggable.js
index 48cdf3689..c0d7ad4ae 100644
--- a/ui/ui.draggable.js
+++ b/ui/ui.draggable.js
@@ -196,12 +196,13 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
if(!(/^(document|window|parent)$/).test(o.containment)) {
var ce = $(o.containment)[0];
var co = $(o.containment).offset();
+ var over = ($(ce).css("overflow") != 'hidden');
this.containment = [
co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) - this.offset.relative.left - this.offset.parent.left,
co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) - this.offset.relative.top - this.offset.parent.top,
- co.left+Math.max(ce.scrollWidth,ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - this.offset.relative.left - this.offset.parent.left - this.helperProportions.width - this.margins.left - (parseInt(this.element.css("marginRight"),10) || 0),
- co.top+Math.max(ce.scrollHeight,ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - this.offset.relative.top - this.offset.parent.top - this.helperProportions.height - this.margins.top - (parseInt(this.element.css("marginBottom"),10) || 0)
+ co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - this.offset.relative.left - this.offset.parent.left - this.helperProportions.width - this.margins.left - (parseInt(this.element.css("marginRight"),10) || 0),
+ co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - this.offset.relative.top - this.offset.parent.top - this.helperProportions.height - this.margins.top - (parseInt(this.element.css("marginBottom"),10) || 0)
];
}