From 1395a6047b7717978076b6007a2d248144c1ed4e Mon Sep 17 00:00:00 2001 From: Richard Worth Date: Mon, 2 Mar 2009 11:57:08 +0000 Subject: [PATCH] demos: droppable photo manager - fixed issue where dialog would not be centered when image first opened. --- demos/droppable/photo-manager.html | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/demos/droppable/photo-manager.html b/demos/droppable/photo-manager.html index cc6dfaa41..868085afc 100644 --- a/demos/droppable/photo-manager.html +++ b/demos/droppable/photo-manager.html @@ -84,15 +84,19 @@ var title = $link.siblings('img').attr('alt'); var $modal = $('img[src$="'+src+'"]'); - $modal.length ? $modal.dialog('open') : $(''+title+'').attr('src',src).appendTo('body').dialog({ - title: title, - width: '400px', - modal: 'true', - overlay: { - backgroundColor: '#000', - opacity: 0.5 - } - }); + if ($modal.length) { + $modal.dialog('open') + } else { + var img = $(''+title+'') + .attr('src',src).appendTo('body'); + setTimeout(function() { + img.dialog({ + title: title, + width: 400, + modal: true + }); + }, 1); + } } // resolve the icons behavior with event delegation