2010-01-15 42 views
2

我正在使用jQuery UI对话框来查看表单。jquery ui dialog top always> 0

此窗体的高度值很大,因此对话框顶部为0px。

我想改变这一点,因为我的窗口顶部有一个菜单栏。

这可能吗?

回答

1

使用position属性

$('#some_dialog_selector').dialog({position:['center',10]}); 

这将打开水平居中的对话框,并从视口的顶部10个像素..

0

如果我理解正确的话,你对话框会覆盖在菜单栏窗口的顶部。 所以你需要手动将这个对话框降低。

您可以使用“位置”选项。它可以是“右”,“左”,“底”或如下“顶” -

`$("#register-dialog").dialog({ 
    bgiframe: true, 
    height: 300, 
    width: 400, 
    modal: true, 
      position: 'bottom' 
    buttons: {` 

或者你也可以在“右上角”定位。如jQuery网站所示 -

Specifies where the dialog should be displayed. Possible values: 'center', 'left', 'right', 'top', 'bottom', or an array containing a coordinate pair (in pixel offset from top left of viewport) or the possible string values (e.g. ['right','top'] for top right corner).