Skip to main content

Search and Top Navigation

#1787 closed bug (fixed)

Opened October 09, 2007 04:35PM UTC

Closed October 24, 2007 09:02AM UTC

Last modified February 26, 2009 11:12AM UTC

Dialog centering on div creation

Reported by: elmkneely Owned by: rdworth
Priority: major Milestone: 1.5
Component: ui.core Version: 1.2.1
Keywords: Cc:
Blocked by: Blocking:
Description

It looks like the issue I found with not centering on scrolling has been resolved (ticket 1703). However, I couldn't find anyplace where it looked like another issue I have found has been noted or addressed.

The issue occurs when trying to set 'position': 'center' on a dialog where you use the $('<div></div>') method of creating the dialog dynamically. Specifically, if you try to get the height/width of uiDialog prior to appending the element to the body, the height and width of uiDialog will be 0 and you won't get a true centering. Here is how I addressed both of these issues in this.open of ui.dialog:

this.open = function() {

var wnd = $(window), top = 0, left = 0;

uiDialog.appendTo('body');

switch (options.position) {

case 'center':

top = (wnd.height() / 2) - (uiDialog.height() / 2) + wnd.scrollTop();

left = (wnd.width() / 2) - (uiDialog.width() / 2) + wnd.scrollLeft();

break;

case 'left':

top = (wnd.height() / 2) - (uiDialog.height() / 2) + wnd.scrollTop();

left = 0;

break;

case 'top':

top = 0;

left = (wnd.width() / 2) - (uiDialog.width() / 2) + wnd.scrollLeft();

break;

}

uiDialog.css({top: top, left: left});

uiDialog.show();

};

Attachments (0)
Change History (4)

Changed October 24, 2007 09:01AM UTC by rdworth comment:1

owner: → rworth
status: newassigned

Changed October 24, 2007 09:02AM UTC by rdworth comment:2

resolution: → fixed
status: assignedclosed

Fixed in rev3726

Changed May 24, 2008 03:39AM UTC by comment:3

milestone: 1.2.2

Milestone 1.2.2 deleted

Changed February 26, 2009 11:12AM UTC by paul comment:4

milestone: → 1.5