I talked a bit with this, and I managed to find the perfect solution. It is intended for pages with or without a headline. It ideally positions the map in the space between the title and the bottom of the page (or on the entire page if the title is missing), for any resolution and any title height.
This solution requires both CSS and JS if the page has a title, and CSS only if the page has no title.
HTML
<div data-role="page" id="mapPage"> <div data-role="header"`> </div> <div data-role="content"> <div id="map-canvas"></div> <p id="nogeolocation"></p> </div> </div>
CSS
#map-canvas { position: absolute; width: 100%; height: 100%; top: 0; left: 0; } #mappopup { line-height: 1.35; overflow: hidden; white-space: nowrap; }
Js
var mapPageHeader = $("#mapPage .ui-header").eq(0); if(mapPageHeader.length > 0) { var headerHeight = mapPageHeader.outerHeight(); $("#map-canvas").css({ 'height': ($(window).height() - headerHeight + 1) + 'px', 'top': headerHeight - 1 }); }
Liran h
source share