Opened 11 years ago

Closed 9 years ago

#4166 closed bug (duplicate)

Resizable does not honor parent scroll

Reported by: Nathaniel Owned by:
Priority: critical Milestone: 1.9.0
Component: ui.resizable Version: 1.6rc6
Keywords: Cc:
Blocked by: Blocking:

Description

I have an absolutely positioned parent with an absolutely positioned resizable within. If I scroll the parent to the left and begin a resize, the resizing element moves left an amount equal to the scrollLeft() of the parent. This can be fixed by simply adding the parent().scrollLeft() to the ui.originalSize.left and the parent().scrollTop() to the ui.originalSize.top, which I am currently doing. However, I am not sure if this is sufficient, as it may mess with things in a place without absolute/absolute positioning.

Attachments (1)

testResizeJump.htm (2.9 KB) - added by pbue 9 years ago.

Download all attachments as: .zip

Change History (11)

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

Milestone: TBD1.6
Priority: majorcritical

comment:2 Changed 11 years ago by rdworth

Milestone: 1.71.8

comment:3 Changed 10 years ago by odugen

First of all position returns absolute position relative to window, thats why scroll of the parent element does not taken into account. Jumping around introduced by bugfix bugfix for http://dev.jquery.com/ticket/1749 so one of the part time solution may be to comment out that fix, for those who don't use dialog. or change if statement to

if (
  el.is('.ui-draggable') && 
  ((/absolute/).test(el.css('position')) && 
  !(/relative/).test(el.parent().css('position')))
)

comment:4 in reply to:  3 Changed 10 years ago by odugen

Replying to odugen:

First of all position returns absolute position relative to window, thats why scroll of the parent element does not taken into account.

Relative to offset parent, but without scroll :) my bad

comment:5 Changed 10 years ago by allixsenos

for my scenario, this resolves the issue completely (as far as I can tell):

/*
    if (o.containment) {
            curleft += $(o.containment).scrollLeft() || 0;
            curtop += $(o.containment).scrollTop() || 0;
    }
*/
// 2009-12-30 LK parent scroll fix
el.parents().each(function(){
    curleft += $(this).scrollLeft() || 0;
    curtop += $(this).scrollTop() || 0;
});

comment:6 Changed 10 years ago by allixsenos

ixnay on the second line, it messes up with browser scroll... horribly.

comment:7 Changed 10 years ago by allixsenos

current version, seems to be working for me:

// 2009-12-30 LK parent scroll bugfix for http://dev.jqueryui.com/ticket/4166
el.parents().each(function(){
    curleft += $(this).scrollLeft() || 0;
    curtop += $(this).scrollTop() || 0;
});
curleft -= this.documentScroll.left;
curtop -= this.documentScroll.top;
Last edited 7 years ago by mikesherov (previous) (diff)

comment:8 Changed 10 years ago by allixsenos

sh... sorry...

// 2009-12-30 LK parent scroll bugfix for http://dev.jqueryui.com/ticket/4166
el.parents().each(function(){
    curleft += $(this).scrollLeft() || 0;
    curtop += $(this).scrollTop() || 0;
});
curleft -= this.documentScroll.left;
curtop -= this.documentScroll.top;

Changed 9 years ago by pbue

Attachment: testResizeJump.htm added

comment:9 Changed 9 years ago by pbue

I've made an example (Attachment). But to me it seems that the resizable only jumps the value of this.element.parent().scrollTop() and left respectively.

#3635 seems a duplicate of this bug, I've left a comment there, but cannot mark it as such.

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

Resolution: duplicate
Status: newclosed

Duplicate of #3635.

Note: See TracTickets for help on using tickets.