Skip to content

Instantly share code, notes, and snippets.

@cythux
Created March 23, 2014 16:24
Show Gist options
  • Save cythux/9725472 to your computer and use it in GitHub Desktop.
Save cythux/9725472 to your computer and use it in GitHub Desktop.
A Pen by Chris Coyier.
<div class="resize">
<p data-height="257" data-theme-id="1" data-slug-hash="gHnGD" data-default-tab="result" class='codepen'>See the Pen <a href='http://codepen.io/chriscoyier/pen/gHnGD'>Transformer Tabs</a> by Chris Coyier (<a href='http://codepen.io/chriscoyier'>@chriscoyier</a>) on <a href='http://codepen.io'>CodePen</a>.</p>
<script async src="//codepen.io/assets/embed/ei.js"></script>
<div class="cover"></div>
</div>
$(".resize").each(function() {
var el = $(this);
var height = el.height();
var cover = el.find("> .cover");
el.resizable({
minHeight: height,
maxHeight: height,
minWidth: 320,
start: function() {
cover.show();
},
stop: function() {
cover.hide();
}
});
});
html {
background: black;
}
html, body {
height: 100%;
}
body {
max-width: 800px;
margin: 0 auto;
background: white;
padding: 20px 0;
}
.resize {
position: relative;
}
.resize > .cover {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment