Skip to content

Instantly share code, notes, and snippets.

@themorgantown
Created August 21, 2014 23:34
Show Gist options
  • Save themorgantown/cbae9330b3e33617b328 to your computer and use it in GitHub Desktop.
Save themorgantown/cbae9330b3e33617b328 to your computer and use it in GitHub Desktop.
my gist description
<script type="text/javascript">
window.onresize = function(event) {
// Input the Width and the Height of your original document. Just Numbers!
var ratioScale = 1108 / 831;
// get the width of the enclosing Div for the Hype element
var currentWidth = document.getElementById('container').offsetWidth;
// Use the width of the Div, and divide it by the Ratio of the W/H of the document
// and set this as the variable for the height of the Iframe.
var iFrameNewHeight = currentWidth / ratioScale;
// set the iframe to have the correct height.
document.getElementById('hypeFrame').style.height = iFrameNewHeight + "px";
};</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment