MAKING AN IFRAME TAKE VERTICAL SPACE

Pravesh Singh

Total Post:412

Points:2888
Posted by  Pravesh Singh
 1256  View(s)
Ratings:
Rate this:

Hi!

I would like to have an iframe take as much vertical space as it needs to display its content and not display a scrollbar. Is it at all possible ?

Are there any workarounds?

Thanks in advance

  1. AVADHESH PATEL

    Post:604

    Points:4228
    Re: Making an iframe take vertical space

    Hi Pravesh!

    This should set the IFRAME height to its content's height:

    <script type="text/javascript">
           var height = document.getElementById('the_iframe').contentWindow.document.body.scrollHeight;
           document.getElementById('the_iframe').height = the_height;
    </script>


    You may want to add scrolling="no" to your IFRAME to turn off the scrollbars.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!