-1

I want to assign a height based on iframe body content to iframe on page load using jquery.

My code is:

<iframe id="loginFrame" class="loginFrame" align="middle" style="border:none;float: left;margin-top: -100px; overflow:hidden;" frameborder="0" src="https://www.example.com" width="700px" scrolling="no"></iframe>

How to set a height for a iframe on page load using jquery.

Thanks,

radha
  • 35
  • 1
  • 8
  • 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) – Pbk1303 Dec 30 '13 at 07:53

1 Answers1

0

You can try getting the iframe height after the iframe loads, see the code below

Jquery:

$("#loginFrame").load(function() {
    $(this).height( $(this).contents().find("body").height());
});
Pbk1303
  • 3,702
  • 2
  • 32
  • 47