[OpenLayers-Users] dynamic map size depending on browser size

Jeroen Vink Jeroen.Vink at hardenberg.nl
Wed Mar 30 08:57:10 EDT 2011


I am trying to make a website with a dynamic map size depending on the size
of the browser. I have the following javascript code:

var max1 = Math.max(Math.min(document.documentElement.clientWidth - 300,
1300), 500);
var max2 = Math.max(Math.min(document.documentElement.clientHeight - 250,
1200), 200);


document.getElementById('nedgeoservices-map').style.width = max1 + "px";
document.getElementById('nedgeoservices-map').style.height = max2+ "px";
	
if (document.getElementById('nedgeoservices-xmain2') != null) {
    var orignalWidth =
Math.max(Math.min(document.documentElement.clientWidth - 300, 1300), 500);
            var numWidth = parseInt(orignalWidth);
            numWidth = numWidth + 22;
            var mapKader = numWidth + "px";
            document.getElementById('nedgeoservices-xmain2').style.width =
mapKader;


which works fine in IE 8 but in FireFox gives a blank map area and the
following error:

maxExtent is null

The site can be found at:

http://geo.hardenberg.nl/test/ http://geo.hardenberg.nl/test/ 

I have tried lots of things and searched many places but I can't find a
solution, can anyone help me fix this problem?

Thanks in advance,

Jeroen Vink

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/dynamic-map-size-depending-on-browser-size-tp6222633p6222633.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list