开发者

JQuery Dialog Div Height

开发者 https://www.devze.com 2022-12-18 07:24 出处:网络
I am trying to get the height of a JQuery UI\'s dialog\'s div once opened, so that I can set the parent\'s iframe height dynamically.

I am trying to get the height of a JQuery UI's dialog's div once opened, so that I can set the parent's iframe height dynamically.

However it seems to be returning me the height of the div b开发者_StackOverflow社区efore the footer button panel and title panel are added. The height for the dialog is set to "auto";

$(this).height($('#dialogdiv').height());

I have tried, outerHeight and offset Height aswell, but get similar results.

Any ideas?


The div you call .dialog() on is actually embedded into another framework of divs that make up the actual jQuery UI Dialog that displays. What you will want to call is this:

$(this).height( $('#dialogdiv').closest('.ui-dialog').height());

You also may still need to play with outerHeight but the important part is the closest which will get the outer dialog wrapper for the Dialog.

If your code looked like this to start:

<div id="dialogdiv"> Contents....</div>

After calling .dialog({ options }) it will look like this (Very simplified):

<div class="ui-dialog ...">
   <div class="ui-dialog-titlebar ..."> ... </div>
   <div id="dialogdiv" class="ui-dialog-content ..."> Contents....</div>
   <div class="ui-dialog-buttonpane ..."> ... </div>
</div>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号