2011-03-01 56 views

回答

1

Looking at the manual,有heightwidthmaxHeightmaxWidth屬性,你將需要使用。要將其調整爲任何瀏覽器窗口大小,您必須使用resize事件,通過單擊手冊上的events選項卡可以看到該事件。

1
var isFullScreen = false; 

function toggleFullScreen() { 

    var windowW = $(window).width(); 
    var windowH = $(window).height(); 

    if (!isFullScreen) { 

     //view full screen mode 
     var wFull = windowW - 100; 
     var hFull = windowH - 100; 

     var xLeft = parseInt((windowW/2) - (wFull/2)); 
     var yTop = parseInt((windowH/2) - (hFull/2));  

     if (dialog != null) { 
      dialog.dialog('option' , 'width', wFull); 
      dialog.dialog('option' , 'height', hFull);  
      dialog.dialog('option', 'position', [xLeft,yTop]); 
     } 

     isFullScreen = true; 

    } else { 

     //view normal/original size mode 
     //use the "dafault" height and width 
     var xLeft = parseInt((windowW/2) - (300/2)); 
     var yTop = parseInt((windowH/2) - (200/2)); 

     if (dialog != null) { 
      dialog.dialog('option' , 'width', 300); 
      dialog.dialog('option' , 'height', 200);  
      dialog.dialog('option', 'position', [xLeft,yTop]); 
     } 

     isFullScreen = false; 
    } 
} 
+0

我喜歡你的答案,但是當屏幕尺寸改變時,全屏幕將不起作用。例如,當您更改平板電腦的方向時,會發生這種情況。是否可以調整對話框的大小? – rakensi 2013-12-14 20:40:53