html - Fill window with iFrame and not show scrollbars? -
How can I fill the window to my iframe and not display any scrollbar?
It works for IE6, if possible, I would like to do it for all browsers:
& lt; Iframe name = iframe1 src = "theSiteToShow.html" width = "100%" height = "100%" frameborder = "0" margin-height = "10" marginwidth = "10" & gt; & Lt; / Iframe & gt; & Lt; Script type = "text / javascript" & gt; Function resizeIframe () {var height = Document.documentElement.clientHeight; Height - = document.getElementById ('frame'). OffsetTop; // Not sure how to get this height dynamically - = 20; / * Whatever you set the margin / padding under your body * / document.getElementById ('frame'). Style Height = height + "px"; }; Document.getElementById ('frame'). Onload = resizeIframe; Window.onresize = resizeIframe; & Lt; / Script & gt;
You can use JavaScript only, without any need for JavaScript should be able. The following works for me in IE6 +, Google Chrome and Safari:
& lt; Style type = "text / css" & gt; Body {margin: 0; Hidden flurry; } # Iframe1 {status: absolute; Left: 0 pixels; Width: 100%; Top: 0 pixels; Height: 100%; } & Lt; / Style & gt; & Lt; Iframe id = "iframe1" name = "iframe1" framebroom = "0" src = "theSiteToShow.html" & gt; & Lt; / Iframe & gt;
Your frame margin must be set in the body of theSiteToShow.html
.
UPDATE
After my comment, I used the following as a test page:
Checked in IE6 +, Chrome, Safari and Firefox, it works just fine and fills the entire window.
Comments
Post a Comment