【发布时间】:2013-11-18 01:46:19
【问题描述】:
我在iframe 中有以下功能:
function modalHgt() {
windowHeight = $(window.parent).height();
complementHeight = $('#complement').outerHeight(true)+20;
popupHeight = $('#main').outerHeight(true);
if ((popupHeight) > (windowHeight-complementHeight)){
popupHeight = windowHeight-complementHeight;
} else {
popupHeight = $('#main').outerHeight(true)+15;
}
$("#sbox-window", top.document).height(popupHeight);
}
我需要在调整大小时调用相同的函数在父。我尝试了以下方法,但它不起作用:
$(function() {
var modalHeightTimer;
$(window).resize(function() {
clearTimeout(modalHeightTimer);
modalHeightTimer = setTimeout($.modalHgt, 50);
});
});
您能否建议我如何在父级中调用 iframe 函数?
【问题讨论】:
标签: javascript jquery iframe resize