diff options
author | Mike Sherov <mike.sherov@gmail.com> | 2014-08-17 14:38:05 -0400 |
---|---|---|
committer | Mike Sherov <mike.sherov@gmail.com> | 2014-08-17 14:38:05 -0400 |
commit | 48ea2aadad11938cc5ddbd9a340c4ca1c997550d (patch) | |
tree | ba2b0803cdb0da3619f54e032ad1550aec11d727 /ui | |
parent | d10440fe44c840dd5c69c4efb1c06d2636fa11c6 (diff) | |
download | jquery-ui-48ea2aadad11938cc5ddbd9a340c4ca1c997550d.tar.gz jquery-ui-48ea2aadad11938cc5ddbd9a340c4ca1c997550d.zip |
Draggable: Ensure overflow:visible containments are correctly measured
Fixes #7016
Diffstat (limited to 'ui')
-rw-r--r-- | ui/draggable.js | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/ui/draggable.js b/ui/draggable.js index 98f065efb..68222b0d5 100644 --- a/ui/draggable.js +++ b/ui/draggable.js @@ -439,7 +439,7 @@ $.widget("ui.draggable", $.ui.mouse, { _setContainment: function() { - var over, c, ce, + var isUserScrollable, c, ce, o = this.options, document = this.document[ 0 ]; @@ -486,13 +486,23 @@ $.widget("ui.draggable", $.ui.mouse, { return; } - over = c.css( "overflow" ) !== "hidden"; + isUserScrollable = /(scroll|auto)/.test( c.css( "overflow" ) ); this.containment = [ ( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ), ( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ), - ( over ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) - ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) - ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) - this.helperProportions.width - this.margins.left - this.margins.right, - ( over ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) - ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) - ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) - this.helperProportions.height - this.margins.top - this.margins.bottom + ( isUserScrollable ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) - + ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) - + ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) - + this.helperProportions.width - + this.margins.left - + this.margins.right, + ( isUserScrollable ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) - + ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) - + ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) - + this.helperProportions.height - + this.margins.top - + this.margins.bottom ]; this.relativeContainer = c; }, |