Created
April 29, 2013 22:27
-
-
Save russ/5485313 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script> | |
<style> | |
#bg-left-extension { | |
width: 1000px; | |
background: blue; | |
} | |
</style> | |
<div id="bg-left-extension" height="100"></div> | |
<script> | |
function getWindowSize() { | |
var w = 0, h = 0; | |
if(typeof(window.innerWidth ) == 'number' ){ | |
w = window.innerWidth; | |
h = window.innerHeight; | |
} else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)){ | |
w = document.documentElement.clientWidth; | |
h = document.documentElement.clientHeight; | |
} else if(document.body && (document.body.clientWidth || document.body.clientHeight)){ | |
w = document.body.clientWidth; | |
h = document.body.clientHeight; | |
} | |
return {width: w, height: h}; | |
} | |
$(document).ready(function() { | |
size = getWindowSize(); | |
$("#bg-left-extension").css('height', size.height); | |
}); | |
$(window).resize(function() { | |
size = getWindowSize(); | |
$("#bg-left-extension").css('height', size.height); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment