7 examples of 'iframe height auto' in JavaScript

Every line of 'iframe height auto' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
121function adjustIframeHeight() {
122 var commentframe = document.getElementById('commentframe');
123 if (commentframe!=null) {
124 commentframe.style.height = '300px';
125 //alert("adjustIframeHeight " + (commentframe.scrollHeight + 10).toString());
126 commentframe.style.height = (commentframe.scrollHeight + 10).toString() + "px";
127 }
128}
1function autoadjustheight(iframeid)
2{
3 // Find the height of the internal page
4 var doc_height = document.getElementById(iframeid).contentWindow.document.body.scrollHeight;
5
6 // Change the height of the iframe
7 document.getElementById(iframeid).height = doc_height;
8}
16function adjustHeight(iframe) {
17 var DOM = KISSY.DOM,
18 win = iframe.contentWindow,
19 doc = win.document,
20 height;
21
22 try {
23 height = DOM.outerHeight(doc, true);
24 if (iframe.height !== height) {
25 iframe.height = height;
26 iframe.width ='100%';
27 }
28 }
29 catch (e) {
30 if (window.console && console.log) {
31 console.log(e.message);
32 }
33 }
34}
1function iFrameHeight(iframe)
2{
3 var doc = 'contentDocument' in iframe ? iframe.contentDocument : iframe.contentWindow.document;
4 var height = parseInt(doc.body.scrollHeight);
5
6 if (!document.all)
7 {
8 iframe.style.height = parseInt(height) + 60 + 'px';
9 }
10 else if (document.all && iframe.id)
11 {
12 document.all[iframe.id].style.height = parseInt(height) + 20 + 'px';
13 }
14}
11function resizeIframe() {
12 var a = document.body,
13 b = document.documentElement,
14 c = Math.max(a.offsetTop, 0),
15 d = Math.max(b.offsetTop, 0),
16 e = a.scrollHeight + c,
17 f = a.offsetHeight + c,
18 g = b.scrollHeight + d,
19 h = b.offsetHeight + d,
20 i = Math.max(e, f, g, h);
21 if (b.clientTop > 0) i += (b.clientTop * 2);
22 var iframe = window.frameElement;
23 var elem = window.parent.document.getElementById(iframe.id);
24 elem.style.height = i + "px";
25// elem.parentNode.style.height = "auto"; // i + "px";
26// window.parent.console.log(iframe.id + ":" + i + "px");
27 if (i < iframe.min_height) setTimeout(resizeIframe, 1000);
28}
60function setIframeHeight(id) {
61 var ifrm = document.getElementById(id);
62 var doc = ifrm.contentDocument? ifrm.contentDocument: ifrm.contentWindow.document;
63 ifrm.style.visibility = 'hidden';
64 ifrm.style.height = "10px"; // reset to minimal height ...
65 // IE opt. for bing/msn needs a bit added or scrollbar appears
66 ifrm.style.height = getDocHeight( doc ) + 4 + "px";
67 ifrm.style.visibility = 'visible';
68 }
91function fixIframeHeight() {
92 HNembed.height($(window).height());
93 HNsite.height(HNembed.height()-20);
94}

Related snippets