with jquery UI dialog, is there anyway to have a max height and use 'auto' if its smaller

前端 未结 8 2187
抹茶落季
抹茶落季 2021-02-07 00:01

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 di

8条回答
  •  失恋的感觉
    2021-02-07 00:19

    I use this:

    $('#dialog').dialog({
        maxHeight: $(window).height(),
        open: function() {
            $(this).dialog('option', 'maxHeight', $(window).height());
       }
    });
    

    Resetting maxHeight in "open" is useful when window has changed size.

提交回复
热议问题