2014-04-24 60 views
1

我有一個JQuery對話框,內部有一個iFrame,它使用一個php文檔來填充圖像和一些信息。它工作正常,但如果我單擊其中一個圖像以轉到完整大小的圖像並將其顯示在iFrame中,則對話框不會調整大小。將JQuery模態對話框動態調整爲IFrame內容

這是在iframe和對話如何生成,我已經刪除了一些額外的代碼,但在這裏它是最重要啄:

$('<iframe id="frameProductos" width="100%" src="articulos_info.php?codigo_art='+val+'" name="frameProductos">').appendTo('body'); 

        var dialog = $("#frameProductos"); 

       dialog.dialog({ 
         title: 'Revisión de producto', 
         resizable: false, 
         modal: true, 
         position: ['center',150], 
         overlay: { 
          opacity: 0.5, 
          background: "black" 
         }, 
         open: function(event, ui) { 

          $('#frameProductos').width('100%'); 
         }, 
        close: function(event, ui) { 
         $(this).dialog('destroy').remove(); 
        }, 
         width: 500, 
         height: 500, 
         buttons: { 
          "Cerrar": function() { 
           $(this).dialog('destroy').remove(); 

          } 

         } 
        }); 

我需要的對話和iframe來改變它們的大小,如果內容的大小更改(單擊圖像並顯示完整分辨率圖像時)。

+0

其實可以添加一個調整的iframe,也是對話,並呼籲從子窗口此功能的js函數必須更新iframe的大小時,圖像上全尺寸。 –

回答

0

重要提示:後加載完成,

$(document).ready(function() { 
     //do somthing like this 
     window.parent.resizeIframe(); 
    });