views:

120

answers:

3

Hi,

I am loading a "html" page in to a div( ex: #targets) using jquery load().The the div comes under the iframe. After loading the html file, the div height and iframe height not getting increased based on the html file content height.

How to change the iframe and div height based on the htm contents in the div.

A: 

try this css code:

div, iframe
{
  overflow:auto;
  height:auto;
}
Sarfraz
A: 

Thanks for the reply.I tried this method....not working :(

ra
try defining specified height like height=100 in your css; replace 100 or whatever with auto keyword that i used in below css.
Sarfraz
A: 

I suggest reading this blog post

jQuery iFrame Sizing

// For some browsers (for opera, safari check blog post, chrome?)
$('iframe').load(function() {
    this.style.height =
    this.contentWindow.document.body.offsetHeight + 'px';
});
jitter