call resizeIframe() function until size is stable
(iframe content finished to load, hopefully) should remove scrollbars on rich oembeds
This commit is contained in:
parent
d4dd863b4b
commit
770bba021e
1 changed files with 16 additions and 1 deletions
17
js/main.js
17
js/main.js
|
@ -1,6 +1,21 @@
|
|||
function resizeIframe(obj) {
|
||||
obj.style.height = 0;
|
||||
obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
|
||||
_resizeIframe(obj, 0);
|
||||
}
|
||||
|
||||
function _resizeIframe(obj, desth) {
|
||||
var h = obj.style.height;
|
||||
var ch = obj.contentWindow.document.body.scrollHeight + 'px';
|
||||
if (h==ch) {
|
||||
return;
|
||||
}
|
||||
console.log("_resizeIframe", obj, desth, ch);
|
||||
if (desth!=ch) {
|
||||
setTimeout(_resizeIframe, 500, obj, ch);
|
||||
} else {
|
||||
obj.style.height = ch;
|
||||
setTimeout(_resizeIframe, 1000, obj, ch);
|
||||
}
|
||||
}
|
||||
|
||||
function openClose(theID) {
|
||||
|
|
Loading…
Reference in a new issue