Skip to content

Instantly share code, notes, and snippets.

@esironal
Last active August 25, 2018 15:38
Show Gist options
  • Save esironal/84673f7ab4bd2f22e8e73b72807229cc to your computer and use it in GitHub Desktop.
Save esironal/84673f7ab4bd2f22e8e73b72807229cc to your computer and use it in GitHub Desktop.
$(document).ready(function() {
function pageY(elem) {
return elem.offsetParent ? (elem.offsetTop + pageY(elem.offsetParent)) : elem.offsetTop;
}
var buffer = 0; //scroll bar buffer
function resizeIframe() {
var height = document.documentElement.clientHeight;
height -= pageY(document.getElementById('ifm')) + buffer;
height = (height < 0) ? 0 : height;
document.getElementById('ifm').style.height = height + 'px';
}
document.getElementById('ifm').onload = resizeIframe;
window.onresize = resizeIframe;
});
<div id="content-wrapper">
<div id="content" class="app-external" role="main">
<iframe id="ifm" src="https://mydraft.cc/"></iframe>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment