#4867 closed bug (worksforme)
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.
Note: See
TracTickets for help on using
tickets.
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.