I have the following function in an 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);
}
and I need to call the same function in the parent when resizing. I tried the following but it doesn't work:
$(function() {
var modalHeightTimer;
$(window).resize(function() {
clearTimeout(modalHeightTimer);
modalHeightTimer = setTimeout($.modalHgt, 50);
});
});
Can you please suggest how can I call the iframe function in parent?