I'm using JQuery and JQuery-Mobile to show a simple UI with a header and a map. I want the map to fit the whole screen, so its height is set to the height of the window minus the height of the header.
My javascript is simple:
$(document).ready(function () {
var maxWidth = $(window).width();
var maxHeight = $(window).height();
var headerHeight = $('#header').outerHeight(true);
var heightMap = maxHeight - headerHeight;
$('#map').css("height",heightMap);
The same lines are in the $(window).resize() function.
The map is well resized when the screen size changes, but the first time I load a page, in landscape, it's about 10 pixels heigher. How can I solve this?