Skip to content

Instantly share code, notes, and snippets.

@ahmetkizilay
Created March 5, 2015 14:02
Show Gist options
  • Select an option

  • Save ahmetkizilay/e4d82ce5fa1d56c1dc21 to your computer and use it in GitHub Desktop.

Select an option

Save ahmetkizilay/e4d82ce5fa1d56c1dc21 to your computer and use it in GitHub Desktop.
<html>
<head>
<style type="text/css">
body
{
margin: 0;
padding: 0;
}
.iframe1
{
height: 100%;
left: 0px;
position: absolute;
top: 0px;
width: 100%;
}
</style>
</head>
<body>
<p>
This is my blog post
<br />
and I feel good about it
</p>
<div class="gc-embed-container">
<iframe src="http://staging.graphcommons.com/graphs/c7a0590c-60cf-49ca-910a-1bd5940ce2c2/embed" frameborder="0" style="display: block; z-index: 1"></iframe>
<br/>
<button class="gc-btn-expand" style="z-index: 2">Click</button>
<script type="text/javascript">
(function() {
var divContainer = document.querySelector('.gc-embed-container');
var btnExpand = document.querySelector('.gc-btn-expand');
var iFrame = document.querySelector('iframe');
var expanded = false;
btnExpand.addEventListener('click', function (e) {
if(!expanded) {
divContainer.style.position = 'absolute';
divContainer.style.top = '0px';
divContainer.style.left = '0px';
divContainer.style.width = '100%';
divContainer.style.height = '100%';
iFrame.style.position = 'absolute';
iFrame.style.width = '100%';
iFrame.style.height = '100%';
btnExpand.style.position = 'absolute';
}
else {
divContainer.style.position = 'inherit';
divContainer.style.top = '0px';
divContainer.style.left = '0px';
divContainer.style.width = '300px';
divContainer.style.height = '300px';
iFrame.style.position = 'inherit';
iFrame.style.width = '100%';
iFrame.style.height = '100%';
btnExpand.style.position = 'inherit';
}
expanded = !expanded;
}, false);
}());
</script>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment