javascript - How to resize iframe to content with header on top? -
i'm trying create search engine type thing when load web page puts navigation bar above content. problem can't seem iframe resize content. i've tried multiple solutions didn't work. problem have iframe not move when header hides on scroll. here code, can @ my site
web.php:
<!doctype html> <html> <body class="web"> <div class="gridcontainer clearfix"> <?php include 'header.html' ?> <div id="web"> <script type="text/javascript"> function adjustiframe(id) { var frame = document.getelementbyid(id); var maxw = frame.scrollwidth; var minw = maxw; var frameh = 100; //iframe starting height frame.style.height = frameh + "px" while (minw == maxw) { frameh = frameh + 100; //increment frame.style.height = frameh + "px"; minw = frame.scrollwidth; } } </script> <iframe id="refframe" onload="adjustiframe('refframe');" class="refframe" src="<?php echo $url ?>"></iframe> </div> <!-- end #web --> </div> <!-- end .gridcontainer --> </body> </html>
css:
#web { position: absolute; top: 70px; width: 100%; margin-left: auto; margin-right: auto; clear: none; float: none; } iframe { width: 100%; }
Comments
Post a Comment