Opened 13 years ago

Closed 10 years ago

#4974 closed bug (worksforme)

Resizable box jumps when position is 0

Reported by: coumont Owned by: mikesherov
Priority: major Milestone: 2.0.0
Component: ui.resizable Version: 1.8a1
Keywords: resizable jump Cc:
Blocked by: Blocking:


I have a resizable div with absolute position. I move it to position 0 (either top or left), with a draggable handle, or a javascript code. Then if I try to resize the box, it will jump to its original position. (see attached file for example)

The problem is in resizable.js, Revision 3243, line 309.

left = (parseInt(self.element.css('left'), 10) 
   + (self.position.left - self.originalPosition.left)) || null,
top = (parseInt(self.element.css('top'), 10) 
   + ( - || null;

If position is 0, then left and top will be set to value 'null'. And the next line

if (!o.animate)
   this.element.css($.extend(s, { top: top, left: left }));

will try to extend to null values. This will just discard current position at offset 0.

This could be solved by setting null values only if css('left') or css('top') are NaN. Or by testing their values before calling extend() :

this.element.css($.extend(s, top && left ? { top: top, left: left }));

Attachments (1)

visual-feedback.html (1.3 KB) - added by coumont 13 years ago.

Download all attachments as: .zip

Change History (9)

Changed 13 years ago by coumont

Attachment: visual-feedback.html added

comment:1 Changed 13 years ago by Jörn Zaefferer

Milestone: TBD1.8

Or by using a !== undefined check, or whatever are invalid values, while 0 is valid...

comment:2 Changed 10 years ago by Scott González


comment:4 Changed 10 years ago by tj.vantoll

Owner: set to coumont
Status: newpending

The attached example functions correctly as of jQuery 1.4.3. This fiddle shows the issue using jQuery 1.4.2 - If you bump up the jQuery version to anything 1.4.3+ the issue goes away.

@coumont or @ kenjiyamamoto - Could you please provide a reduced test case showing this issue. To get you started, use this boilerplate: Open the link and click to "Fork" (in the top menu) to get started.

comment:5 Changed 10 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

comment:6 Changed 10 years ago by mikesherov

Resolution: invalid
Status: closedreopened

comment:7 Changed 10 years ago by mikesherov

Owner: changed from coumont to mikesherov
Status: reopenedassigned

I'm investigating this issue. I know it's gone as of 1.4.3, but technically, it should still be a problem. I'd like to know why it isn't.

comment:8 Changed 10 years ago by mikesherov

Resolution: worksforme
Status: assignedclosed

This issue was fixed when invalid css could no longer be set: I feel satisfied now.

Note: See TracTickets for help on using tickets.