Reputation: 13
I want to check that if an element is less than the browser length minus two other elements using jquery this is the code i currently have
<script>
var browser = $(window).height();
var post = $('#PostContainer').height();
var hf = $('#Header').height() + $('#Footer').height();
var remainder = browser - hf;
if (post < remainder) {
$('#Footer').css({position: 'absolute', bottom: '0px'});
} else {
$('#Footer').css({position: 'relative'});
}
</script>
but it doesn't work so how would i do it?
Upvotes: 0
Views: 43
Reputation: 17671
Your jQuery lacks a document ready event handler, so it's not triggering... wrap your existing code with the the following:
$( document ).ready(function() {
// Your code here
});
Upvotes: 1