2010-12-08 41 views
1

我在將對話框窗口調整到屏幕中心時遇到了一個小問題。 位置設置爲中心,但問題是,dailog窗口的左上角是與屏幕中心對齊的位置...有什麼方法可以解決這個問題。將對話窗口調整到屏幕中央

// Dialog box properties for Select drive 
    $(".Drive").dialog({ 
    title: 'Form Design' 
    , width: 'auto' 
    , height: 'auto' 
    , autoOpen: false 
    , position: 'center' 
    , closeOnEsc: true 
    , modal: true, 
    }); 
    $('.driveChoose').click(function(){ 
    var modalUrl = $(this).attr('title'); 
    $('.Drive').load(modalUrl).dialog('open'); 
    return false; 
    }); 

回答

0

能正常工作對我來說:

<script type="text/javascript" src="/js/jqueryui/jquery.ui.position.js"></script> 

$(".Drive").dialog({ 
    position: ['center', 'center'] 
}); 
+0

號。對我來說存在同樣的問題,即使現在.. :-( – Sullan 2010-12-10 05:17:34

0

古老的問題,但也有一對夫婦爲這個很常見的元兇。

  1. 當打開對話框時,根據對話框的內容完成對中。如果您在.open之後添加內容,那麼這將解釋頂級居中的原因(因爲div最初是emtpy)。
  2. 你可能會缺少jquery-ui的一些文件,或者你可能有jquery.dimensions.js,它們不應該在那裏。這裏更多的信息:Dialog box not positions center screen