This is a very bizzare thing I am trying to solve.
Currently I am loading all of this at the end of my page and when I first load the page it alerts 571 and on a refresh it alerts 627. Whereas if I move this all to the <head> tag it alerts 627 every time and that is the correct value.
Can anyone see why loading this at the end of a page would lead to a wrong smaller window height?
<script src="js/jquery.min.js"></script>
<script>
$(document).ready(function() {
var Height = $(window).height()-40;
$("#section1").css('min-height',Height);
$("#section2").css('min-height',Height);
alert(Height);
});
</script>
Seriously I have no clue why this happens. To find out I would definitely need the code of the whole page or a working live example.
But in your case I would just use
$(window).loadinstead of ready.