Skip to main content

Search and Top Navigation

#4166 closed bug (duplicate)

Opened February 17, 2009 05:16AM UTC

Closed September 24, 2010 12:11PM UTC

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)
Change History (10)

Changed February 17, 2009 12:01PM UTC by jzaefferer comment:1

milestone: TBD1.6
priority: majorcritical

Changed March 08, 2009 02:34PM UTC by rdworth comment:2

milestone: 1.71.8

Changed July 16, 2009 07:36AM UTC by odugen comment:3

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')))
)

Changed July 16, 2009 07:42AM UTC by odugen comment:4

Replying to [comment:3 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

Changed December 30, 2009 10:12AM UTC by allixsenos comment:5

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;
});

Changed December 31, 2009 11:01AM UTC by allixsenos comment:6

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

Changed January 13, 2010 02:30PM UTC by mikesherov comment:7

_comment0: 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; \ 1352873107349615

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;

Changed January 13, 2010 02:32PM UTC by allixsenos comment:8

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 September 24, 2010 10:29AM UTC by pbue comment:9

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.

Changed September 24, 2010 12:11PM UTC by scottgonzalez comment:10

resolution: → duplicate
status: newclosed

Duplicate of #3635.