$(document).on("hidden.bs.modal shown.bs.modal shown.bs.tab", resize_iframe); function resizeIframe(height) { //console.log('Resize for AppInstance'); $('iframe#app_iframe').height(height); } let height_prev; function resize_iframe() { if (typeof(hallwayPrefix) !== "undefined" && hallwayPrefix == "") { return; } var height = 0; if ($(".modal-dialog").height() + 100 > $("body").height()) { height = $(".modal-dialog").height() + 100; } else if ( $(".dropdown-menu.table_visiblity.ui-sortable:visible").height() + 150 > $("body").height() ) { height = $(".dropdown-menu.table_visiblity.ui-sortable:visible").height() + 150; } else if ($("#canvas").is(":visible")) { var canvas_height = window.innerHeight - ($("#breadcrumbs").height() + $(".green-header").height() + 20); $("#canvas").css("height", "500px"); height = $("body").height(); } else if ($("#canvas-swimlane").is(":visible")) { $("#canvas-swimlane").css("height", "300px"); height = $("body").height() + $("#task_data").height() - 160; } else { height = $("body").height() + 25; } if (height_prev != height) { window.parent.postMessage({ func: "resizeIframe", height: height }, "*"); } height_prev = height; } // Function to be called from iframe function receiveMessage(event) { if (event.origin !== window.location.origin) return; var data = event.data; if (typeof window[data.func] == "function") { window[data.func].call(null, data.type, data.url); } else { console.log("Function not found: " + data.func); } }