]> source.dussan.org Git - jquery-ui.git/commitdiff
core: hasScroll now checks for overflow hidden, since then the users wants scroll...
authorPaul Bakaus <paul.bakaus@googlemail.com>
Tue, 16 Sep 2008 10:38:12 +0000 (10:38 +0000)
committerPaul Bakaus <paul.bakaus@googlemail.com>
Tue, 16 Sep 2008 10:38:12 +0000 (10:38 +0000)
draggable: containment respects overflow hidden (fixes #3328)

ui/ui.core.js
ui/ui.draggable.js

index 9275c5fc179658ea7180c4f9e00eb38d6038d7a3..b7e89b37ec9f526bffdcff5c91b8ad4894a2b669 100644 (file)
@@ -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;
                
index 48cdf36891ad269479f3952af2511194b7d23599..c0d7ad4ae49bf46c858c9a33272551b21413550e 100644 (file)
@@ -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)
                        ];
                }