So basically, I want a div called #content to have a css top value of 200px if the browser height is less than 440px. However, this seems to not be working. What am I doing wrong?
var boh = $(window).height();
var bohi = parseInt(boh);
if(bohi < 440) {
$("#content").css("top","200px");
} else {
//this part works, so it's hidden
}
I think you need to handle $(window).resize() event or that logic is only going to be run once.
Here is a jsfiddle that seems to be working:
Note that
$(window).height()doesn’t need theparseInt()its already treated as a number.