Skip to content

Instantly share code, notes, and snippets.

@jackilyn
Created January 27, 2012 20:32
Show Gist options
  • Select an option

  • Save jackilyn/1690776 to your computer and use it in GitHub Desktop.

Select an option

Save jackilyn/1690776 to your computer and use it in GitHub Desktop.
Half & Half
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Half &amp; Half</title>
<style type="text/css">
* {
margin: 0;
padding: 0;
}
#top {
background: #1B242A;
}
#bottom {
background: #0080FF;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
$(function(){
var $window = $(window);
winHeight = $window.height();
$("#top").height(winHeight/2);
$("#bottom").height(winHeight/2);
$(window).resize(function(){
winHeight = $window.height();
$("#top").height(winHeight/2);
$("#bottom").height(winHeight/2);
});
});
</script>
</head>
<body>
<div id="top"></div>
<div id="bottom"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment