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

Improve iframe resizing

parent c60e117d
No related branches found
No related tags found
No related merge requests found
......@@ -145,6 +145,24 @@ output +="</ul></nav>";
$(".table-of-contents").html(output);
// Set iframe height for patterns
if ($('#building-block-iframe').length > 0) {
$('#building-block-iframe').css('min-height',document.getElementById('building-block-iframe').contentWindow.document.body.scrollHeight+'px')
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();
}
}
setHeightOfPatternIframe();
var resizeTimer;
function delayedCheckOfIframeHeight() {
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function() {
setHeightOfPatternIframe();
}, 250);
}
// Resize after user has finished resizing a window
$(window).on('resize', function(e) {
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