Skip to content
Snippets Groups Projects
Commit 84462d4a authored by Ken Hawkins's avatar Ken Hawkins
Browse files

Even better iframe resizing!

parent 45bf8caf
No related branches found
No related tags found
No related merge requests found
......@@ -148,11 +148,15 @@ $(".table-of-contents").html(output);
function setHeightOfPatternIframe() {
var iframeHeightPadding = 5; // to prevent scrolling for 1px of margin or such
if ($('#building-block-iframe').length > 0) {
$('#building-block-iframe').css('min-height',(document.getElementById('building-block-iframe').contentWindow.document.body.scrollHeight+iframeHeightPadding)+'px')
delayedCheckOfIframeHeight();
try {
$('#building-block-iframe').css('min-height',(document.getElementById('building-block-iframe').contentWindow.document.body.scrollHeight+iframeHeightPadding)+'px')
}
catch(error) {
setHeightOfPatternIframe(); // iframe probably wasn't fully loaded, try again
// console.error(error);
}
}
}
setHeightOfPatternIframe();
var resizeTimer;
function delayedCheckOfIframeHeight() {
......@@ -166,3 +170,4 @@ function delayedCheckOfIframeHeight() {
$(window).on('resize', function(e) {
delayedCheckOfIframeHeight();
});
delayedCheckOfIframeHeight();
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment