aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorMike Sherov <mike.sherov@gmail.com>2013-04-03 12:26:39 -0400
committerMike Sherov <mike.sherov@gmail.com>2013-04-03 12:26:39 -0400
commit49c7b7200ef944ffc93487e79e763dfe97b4ff4a (patch)
tree4ed188b4de87a6fde2e6f07da460be7370b128d6 /ui
parenta88d64514001867b908776e6bfcfac7f1011970d (diff)
downloadjquery-ui-49c7b7200ef944ffc93487e79e763dfe97b4ff4a.tar.gz
jquery-ui-49c7b7200ef944ffc93487e79e763dfe97b4ff4a.zip
Draggable: Don't cache parent offset if the parent position is fixed. Fixes #5009 - Draggable: scroll not working with parent's position fixed
Diffstat (limited to 'ui')
-rw-r--r--ui/jquery.ui.draggable.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/ui/jquery.ui.draggable.js b/ui/jquery.ui.draggable.js
index 4814cb851..64cf339e0 100644
--- a/ui/jquery.ui.draggable.js
+++ b/ui/jquery.ui.draggable.js
@@ -125,8 +125,10 @@ $.widget("ui.draggable", $.ui.mouse, {
this._cacheMargins();
//Store the helper's css position
- this.cssPosition = this.helper.css("position");
+ this.cssPosition = this.helper.css( "position" );
this.scrollParent = this.helper.scrollParent();
+ this.offsetParent = this.helper.offsetParent();
+ this.offsetParentCssPosition = this.offsetParent.css( "position" );
//The element's absolute position on the page minus margins
this.offset = this.positionAbs = this.element.offset();
@@ -184,6 +186,10 @@ $.widget("ui.draggable", $.ui.mouse, {
},
_mouseDrag: function(event, noPropagation) {
+ // reset any necessary cached properties (see #5009)
+ if ( this.offsetParentCssPosition === "fixed" ) {
+ this.offset.parent = this._getParentOffset();
+ }
//Compute the helpers position
this.position = this._generatePosition(event);
@@ -320,7 +326,6 @@ $.widget("ui.draggable", $.ui.mouse, {
_getParentOffset: function() {
//Get the offsetParent and cache its position
- this.offsetParent = this.helper.offsetParent();
var po = this.offsetParent.offset();
// This is a special case where we need to modify a offset calculated on start, since the following happened: