Skip to content

Instantly share code, notes, and snippets.

@brianarn
Created May 18, 2012 16:21
Show Gist options
  • Save brianarn/2726190 to your computer and use it in GitHub Desktop.
Save brianarn/2726190 to your computer and use it in GitHub Desktop.
Cleanup tweak for Ben
(function(){
document.write('<iframe src="http://www.yourwebsite.com/path/embed.html" width="100%" border="0" frameBorder="0" style="border:0;" id="the-embed-id"><' + '/iframe>');
var the_iframe = document.getElementById('the-embed-id'),
offsetWidth = the_iframe.offsetWidth, newHeight = '60px';
if (offsetWidth < 300) {
newHeight = '600px';
} else if (offsetWidth < 400) {
newHeight = '300px';
} else if (offsetWidth < 600) {
newHeight = '80px';
}
the_iframe.style.height = newHeight;
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment