I'm experiment an inconsistent result trying to get the height
of the browser's window.
To do it, I am using $(window).height();
on document ready and I've noticed I get different values (with 15px of difference) between cases.
It seems that the results get influenced by the style sheet I am applying. Deleting the style sheet solve the problem (or just removing a couple of lines (such as font-size: 2em;
, float:left;
position:absolute;
... things which doesn't seem to be related at all)
I believe styles should not be related with the browser's window size at all. Shouldn't it be returning exactly the same value for any case?
I've read the documentation of $.height() and it doesn't say anything about this topic.
I've also noticed it returns the correct dimensions when called on load like so:
$(window).on('load', function() {
var windowHeight = $(window).height();
console.log(windowHeight);
});
I'm sorry but I couldn't reproduce my problem at jsfiddle.