Skip to content

Instantly share code, notes, and snippets.

@cwalkersp
Created January 7, 2016 17:07
Show Gist options
  • Select an option

  • Save cwalkersp/c1879cb40f9d78d45688 to your computer and use it in GitHub Desktop.

Select an option

Save cwalkersp/c1879cb40f9d78d45688 to your computer and use it in GitHub Desktop.
<html>
<head>
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
</head>
<body>
<div id="iframe-container"></div>
<!-- Assuming we have jQuery - easy to do without though -->
<script type="text/javascript">
var iframe,
height = window.innerHeight,
width = window.innerWidth;
function resizeChild() {
height = window.innerHeight,
width = window.innerWidth;
// TODO - update this to actual appropriate calculations
iframe.height = height / 2 + 'px';
iframe.width = width / 2 + 'px';
}
$(document).ready(function() {
var container = $('#iframe-container');
iframe = document.createElement('iframe');
// THIS_SHOULD_COME_FROM_DJANGO_VIEW_CONTEXT
// iframe.src = '{{ iframe_src }}';
iframe.src = 'http://www.metalinjection.net/';
// TODO - update this to actual appropriate calculations
iframe.height = height / 2 + 'px';
iframe.width = width / 2 + 'px';
container.append(iframe);
$(window).resize(resizeChild);
});
</script>
<!-- c['iframe_src'] = settings.SP_BILLING_ENDPOINT['base_url'] + '/subscriptions/FILL_ME_IN -->
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment