javascript - JQuery Dialog Div Height - Stack Overflow

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

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 before 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?

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 before 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?

Share Improve this question asked Jan 26, 2010 at 14:52 cwestoncweston 11.7k21 gold badges85 silver badges107 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

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>

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745322876a4622522.html

相关推荐

  • javascript - JQuery Dialog Div Height - Stack Overflow

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

    8小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信