-2

i have an Iframe with a height of 534px. The content inside the Iframe has the option to minimize the content so the height of content changes from 534px to maybe 20px. How can I make my Iframe height dynamic to suit the inner content that is on show?

Thanks.

Ricky Barnett
  • 1,130
  • 3
  • 15
  • 32
  • 1
    Possible duplicate of [make iframe height dynamic based on content inside- JQUERY/Javascript](http://stackoverflow.com/questions/9162933/make-iframe-height-dynamic-based-on-content-inside-jquery-javascript) – Marcos Pérez Gude Dec 14 '15 at 11:06

1 Answers1

0

After your content changes(event/action), Do This

    function AdjustIframe()
    {
       YouIframeId.height = YouIframeId.contentWindow.document.body.scrollHeight;
    }

Inside your iframe, the change function.

function someChangeEvent()
{
  //at end of your code
  parent.AdjustIframe();
}