小编Arn*_*nab的帖子

调整大小后如何获得对话框的高度和宽度?

我成功创建了一个带有调整大小启用的对话框但是对于我的项目,我需要在用户调整大小后打开对话框的高度和宽度.

我创建了一个id = opener的按钮和一个id = dialog的div.有人可以帮助我.

使用Javascript:

// increase the default animation speed to exaggerate the effect
$.fx.speeds._default = 1000;
$(function() 
{
    $( "#dialog" ).dialog(
    {
        modal:true,
        autoOpen: false,
        show: "blind",
        hide: "explode",
        buttons: [
        {
            text: "Ok",
            click: function() { $(this).dialog("close"); }
        }] ,
        resizable: true,
        width:'auto',
        height:'auto'
    });

    $( "#opener" ).click(function() 
    {
        $( "#dialog" ).dialog( "open" );
        return false;
    });
});
Run Code Online (Sandbox Code Playgroud)

HTML:

<body>
    <div class="demo">
        <div id="dialog" title="Basic dialog">
            <p>My content here. I want to show the height …
Run Code Online (Sandbox Code Playgroud)

jquery dialog jquery-ui modal-dialog jquery-ui-dialog

5
推荐指数
1
解决办法
9203
查看次数