don't resize iframe if we can't find a final size greater than 0
This commit is contained in:
parent
6da04d16bd
commit
7965f72c8c
34
js/main.js
34
js/main.js
|
@ -1,22 +1,22 @@
|
||||||
function resizeIframe(obj) {
|
function resizeIframe(obj) {
|
||||||
obj.style.height = 0;
|
//obj.style.height = 0;
|
||||||
_resizeIframe(obj, 0);
|
_resizeIframe(obj, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
function _resizeIframe(obj, desth) {
|
function _resizeIframe(obj, desth) {
|
||||||
var h = obj.style.height;
|
var h = obj.style.height;
|
||||||
var ch = obj.contentWindow.document.body.scrollHeight + 'px';
|
var ch = obj.contentWindow.document.body.scrollHeight + 'px';
|
||||||
if (h==ch) {
|
if (h==ch) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
console.log("_resizeIframe", obj, desth, ch);
|
||||||
|
if (desth!=ch) {
|
||||||
|
setTimeout(_resizeIframe, 500, obj, ch);
|
||||||
|
} else {
|
||||||
|
if (ch>0) obj.style.height = ch;
|
||||||
|
setTimeout(_resizeIframe, 1000, obj, ch);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
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) {
|
function openClose(theID) {
|
||||||
if(document.getElementById(theID).style.display == "block") {
|
if(document.getElementById(theID).style.display == "block") {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user