From 9030384875f1673e846a0a94b9866ba5375bae20 Mon Sep 17 00:00:00 2001 From: kborchers Date: Tue, 17 May 2011 10:13:45 -0500 Subject: [PATCH 1/2] Resizable: Added checks to base position off of offset rather than position when position is fixed and remove position when IE changes from fixed to static. Fixed #3628 - resizable does not support position: fixed --- ui/jquery.ui.resizable.js | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/ui/jquery.ui.resizable.js b/ui/jquery.ui.resizable.js index e0579ef8496..2be6b70f79a 100644 --- a/ui/jquery.ui.resizable.js +++ b/ui/jquery.ui.resizable.js @@ -38,6 +38,12 @@ $.widget("ui.resizable", $.ui.mouse, { var self = this, o = this.options; this.element.addClass("ui-resizable"); + + //IE does not support position:fixed; and explicitly sets position:static; which causes the handles + //to be positioned incorrectly. IE6 does not change fixed to static so a separate check is added (see ticket #3628) + if( this.element.css( "position" ) === "static" || this.element.css( "position" ) === "fixed" && $.browser.msie && $.browser.version < 7 ) { + this.element.css( "position", "" ); + } $.extend(this, { _aspectRatio: !!(o.aspectRatio), @@ -301,10 +307,19 @@ $.widget("ui.resizable", $.ui.mouse, { // plugins callbacks need to be called first this._propagate("resize", event); - el.css({ - top: this.position.top + "px", left: this.position.left + "px", - width: this.size.width + "px", height: this.size.height + "px" - }); + //If position is fixed, set top and left based on offset rather than position + //to prevent the resizable from jumping to 0,0 when top and left are not set (see ticket #3628) + if( el.css( "position" ) === "fixed" ) { + el.css({ + top: this.offset.top + "px", left: this.offset.left + "px", + width: this.size.width + "px", height: this.size.height + "px" + }); + } else { + el.css({ + top: this.position.top + "px", left: this.position.left + "px", + width: this.size.width + "px", height: this.size.height + "px" + }); + } if (!this._helper && this._proportionallyResizeElements.length) this._proportionallyResize(); From 4a120d16f08a3da028ad881cacda1f916be81321 Mon Sep 17 00:00:00 2001 From: kborchers Date: Tue, 24 May 2011 08:53:12 -0500 Subject: [PATCH 2/2] Resizable: (Updated) Added checks to base position off of offset rather than position when position is fixed and remove position when set to static. Fixed #3628 - resizable does not support position: fixed --- ui/jquery.ui.resizable.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ui/jquery.ui.resizable.js b/ui/jquery.ui.resizable.js index 2be6b70f79a..bc11f03418e 100644 --- a/ui/jquery.ui.resizable.js +++ b/ui/jquery.ui.resizable.js @@ -41,7 +41,8 @@ $.widget("ui.resizable", $.ui.mouse, { //IE does not support position:fixed; and explicitly sets position:static; which causes the handles //to be positioned incorrectly. IE6 does not change fixed to static so a separate check is added (see ticket #3628) - if( this.element.css( "position" ) === "static" || this.element.css( "position" ) === "fixed" && $.browser.msie && $.browser.version < 7 ) { + $.offset.initialize(); + if( this.element.css( "position" ) === "static" ) { this.element.css( "position", "" ); } @@ -309,9 +310,9 @@ $.widget("ui.resizable", $.ui.mouse, { //If position is fixed, set top and left based on offset rather than position //to prevent the resizable from jumping to 0,0 when top and left are not set (see ticket #3628) - if( el.css( "position" ) === "fixed" ) { + if( el.css( "position" ) === "fixed" && $.offset.supportsFixedPosition ) { el.css({ - top: this.offset.top + "px", left: this.offset.left + "px", + top: el.offset.top + "px", left: el.offset.left + "px", width: this.size.width + "px", height: this.size.height + "px" }); } else {