Skip to content

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 #298

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions ui/jquery.ui.resizable.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ $.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)
$.offset.initialize();
if( this.element.css( "position" ) === "static" ) {
this.element.css( "position", "" );
}

$.extend(this, {
_aspectRatio: !!(o.aspectRatio),
Expand Down Expand Up @@ -301,10 +308,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" && $.offset.supportsFixedPosition ) {
el.css({
top: el.offset.top + "px", left: el.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();
Expand Down