0

I need to set the height of the iframe according to the content.

<iframe src="../graphs/Average.html" alt="##graphname" width=100% height=680px overflow:visible frameborder=0 class="general" style="border-collapse: collapse;" noresize onload="document.getElementById('p').style.display='none';"></iframe>

I have also tried: <style> div{overflow:visible} </style> But its also not working.

Suresh Atta
  • 120,458
  • 37
  • 198
  • 307
Garima Rawat
  • 21
  • 2
  • 5
  • Already answered here: http://stackoverflow.com/questions/819416/adjust-width-height-of-iframe-to-fit-with-content-in-it – Koby Douek Mar 09 '17 at 13:01
  • 3
    Possible duplicate of [Adjust width height of iframe to fit with content in it](http://stackoverflow.com/questions/819416/adjust-width-height-of-iframe-to-fit-with-content-in-it) – Koby Douek Mar 09 '17 at 13:02
  • 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) – Grim... Mar 09 '17 at 13:02

1 Answers1

0

For this you can use following JScode:

<iframe id="iframe" src="../graphs/Average.html" alt="#graphname" width="100%" height="680"  frameborder=0 class="general" style="border-collapse: collapse;" noresize onload="document.getElementById('p').style.display='none';"></iframe>    

Using javascript

document.getElementById("iframe").style.height = $('#iframe').get(0).contentWindow.document.body.offsetHeight + 'px'

Using jQuery

$('#iframe').height($('#iframe').get(0).contentWindow.document.body.offsetHeight + 'px');
Super User
  • 9,448
  • 3
  • 31
  • 47
  • With this also overflow:visible is not working. Scroll bar is coming,i need the data in full length of page not in scroll. – Garima Rawat Mar 13 '17 at 07:16