代码之家  ›  专栏  ›  技术社区  ›  dcp

jquery对话框未居中

  •  0
  • dcp  · 技术社区  · 14 年前

    编辑:重写这是html只

    <html>
    <head>
        <script type="text/javascript" src="jquery-1.4.2.min.js"></script>
        <script type="text/javascript" src="ui/jquery.ui.core.js"></script>
        <script type="text/javascript" src="ui/jquery.ui.widget.js"></script>
        <script type="text/javascript" src="ui/jquery.ui.dialog.js"></script>
        <link type="text/css" href="themes/base/jquery.ui.all.css" rel="stylesheet" />
    
    <script>
      function showDialog() {
        $("#dialog-modal").dialog({
            resizable: true,
            height: 140,
            modal: true,
            position: 'center',
            buttons: {
                'Yes': function () {
                    $(this).dialog("close");
                    return true;
                },
                'No': function () {
                    $(this).dialog("close");
                    return false;
                }
            }
        });
      }
    </script>
    
    </head>
    <body>
    
    <div style="width:800px; height:800px; border:solid 1px red;">
    
    <div id="dialog-modal" title="Basic dialog"></div>
    
    <input type="button" value="test" onclick="showDialog();"></input>
    
    </div><!-- End demo -->
    
    
    </body>
    
    </html>
    
    2 回复  |  直到 14 年前
        1
  •  0
  •   Rubens Mariuzzo Salakar    14 年前

    我已经重现了你在 http://jsfiddle.net/zjRga/1/ . 我已经测试过几次了,我无法重现你所说的。你能再核对一下吗?你能确认我们你没有使用任何额外的CSS吗?

    注意 :我做了一些小的(非关键的)更改以使其正常工作。

        2
  •  0
  •   dcp    14 年前

    我通过添加以下内容来解决这个问题:

    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.3/jquery-ui.min.js"
        type="text/javascript"></script>
    <script src="http://jquery-ui.googlecode.com/svn/tags/latest/external/jquery.bgiframe-2.1.1.js"
        type="text/javascript"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.3/i18n/jquery-ui-i18n.min.js"
        type="text/javascript"></script>