Skip to main content

Search and Top Navigation

#4867 closed bug (worksforme)

Opened September 19, 2009 09:50AM UTC

Closed October 06, 2009 01:28AM UTC

Last modified October 11, 2012 09:15PM UTC

Dialog with image content auto width/height has wrong position on first launch

Reported by: bterkuile Owned by:
Priority: minor Milestone:
Component: ui.dialog Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:
Description

I wanted to create a dialog for images. The ui dialog seems to work fine, except the auto height/width function and positioning. My example (jQuery 1.3.2, ui: 1.7.2):

$('<img src="img_src.png" title="Image!">').dialog({
  modal: true,
  width: 'auto',
  height: 'auto'
});

After a page refresh the image displays nice according to it's width and height but the top left corner of the model is centered in stead of the modal center. After closing the dialog and reopening the second time, it appears at the center as expected.

This behaviour is confirmed for (Windows):

  • Chrome 2.0172.43
  • Firefox 3.5.3
  • Opera 10.00

Internet Explorer 8 seems to work fine.

Attachments (0)
Change History (2)

Changed October 06, 2009 01:28AM UTC by scottgonzalez comment:1

resolution: → worksforme
status: newclosed

Sounds like you're opening the dialog before the image loads. You need to account for that on your own. My suggestion would be to bind to the load event of the image and tell the dialog to reposition itself.

Changed October 11, 2012 09:15PM UTC by scottgonzalez comment:2

milestone: TBD

Milestone TBD deleted