jQuery UI对话框中,是否有最大高度,如果较小则使用'auto' [英] with jquery UI dialog, is there anyway to have a max height and use 'auto' if its smaller

查看:88
本文介绍了jQuery UI对话框中,是否有最大高度,如果较小则使用'auto'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望对话框具有最大高度设置,但是,如果内容较小,则缩小以执行height = 'auto'的操作.在JQuery UI对话框中可以吗?

I want a dialog to have a max height setting but, if the content is smaller, then to shrink down to do what height = 'auto' does. Is this possible in JQuery UI dialog?

推荐答案

您可以执行以下操作:

HTML

<div id="dialog" title="Dialog Title">
    Dialog content
</div>

JavaScript

$('#dialog').dialog({
    resizable: false,
    minHeight: 0,
    create: function() {
        $(this).css("maxHeight", 400);        
    }
});

查看关于jsFiddle的测试案例.

这篇关于jQuery UI对话框中,是否有最大高度,如果较小则使用'auto'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆