It seems to me that Firefox ought to be better equipped to return the proper value when using $(window).height()
.
I am using jQuery 1.8.2. Is this a bug in that particular build? Every other browser I have tested returns an appropriate value when calculating viewport height.
To work around this, I've used snip below to apply a pixel value to a div.
$(window).bind('cwsObjectsShown', function() {
var height = $(window).height();
if (height === 0) {
height = window.innerHeight;
}
height = height - '120';
$('#game_objects').css('height', height + 'px');
});
jQuery's $(window).height() is sensitive to doctype. Try <!doctype html> ?
The jQuery 1.8.1 release notes say
For example, with jQuery 1.8.2 and Firefox 16, I get a valid $(window).height() with doctype html, but height 0 with doctype html5. In Chromium 20, both work. (The W3C HTML5 spec does say to use doctype html, not html5.)