Internet Explorer中的jQuery UI Dialog和maxHeight

时间:2010-12-21 17:08:38

标签: javascript jquery jquery-ui jquery-dialog css

这是我目前的代码:

$("#DialogScroll").dialog({
                bgiframe: true,
                autoOpen: false,
                maxHeight: 600,
                width: 550,
                modal: true,
                resizable: false,
                open: function (type, data) {
                    $(this).parent().appendTo("form");
                },
                close: function () { }
            });

maxHeight在预期的Firefox,Chrome等中运行良好,但IE 7显然存在问题。有没有人知道如何让UI对话框在IE中使用maxHeight?

<div id="DialogScroll" class="dialog" style="display:none; ">
        <table>
            <thead>
                <tr>
                    <th>
                        State Code
                    </th>
                    <th>
                        State Name
                    </th>
                </tr>
            </thead>
            <tbody>
                <asp:Literal ID="litStates" runat="server" />
            </tbody>
        </table>
    </div>

2 个答案:

答案 0 :(得分:5)

看起来这是一个长期存在的open jQueryUI bug - 在这个链接中,有一个解决方法和补丁中列出的补丁。

答案 1 :(得分:3)

Dean指出的链接最近更新了一个很好的解决方案,对我有用:

  

此外,您可以通过'vol7ron'应用自己的CSS;类似的东西:

$('#dialog')
   .dialog( { modal : true } )
   .css( { 'max-height' : '50px' } );

因此,在您的情况下:

$("#DialogScroll").dialog({
    bgiframe: true,
    autoOpen: false,
    width: 550,
    modal: true,
    resizable: false,
    open: function (type, data) {
        $(this).parent().appendTo("form");
    },
    close: function () { }
}).css( { 'max-height' : '600px'} );