[OpenLayers-Users] 'Fluid' map in IE

sendeman martijnsendenspam at gmail.com
Wed Apr 22 05:00:34 EDT 2009


Hi All,

Last week I managed to set up a simple localhost map server using Openlayers
and UMN Mapserver. It all worked, across all modern browsers. It was however
a straightforward example wit a map that had a fixed width and height. In
the real page I'm making, the map needs to be in a div that is positioned as
follows:

#map {
   position: absolute;
   top: 90px;
   left: 10px;
   right:10px;
   bottom: 36px;
}

In Firefox this works, but of course, IE can't handle both a top and a
bottom declaration on one element (nor both a left and a right declaration).
The way I normally solve this is by adding extra stylesheets for versions of
IE. I load them using conditional comments.

The IE7 stylesheet would look like this:
#map {
   height: expression(document.documentBody.clientHeight - 126 +"px");
   width: expression(document.documentBody.clientwidth - 20 +"px");
}

The IE6 stylesheet would look like this:
#map {
   height: expression(document.documentElement.clientHeight - 126 +"px");
   width: expression(document.documentElement.clientWidth - 20 +"px");
}

All that works in IE, as long as I don't try to add an Openlayers map to the
div. I guess the problem is that IE handles the CSS after it handles the
Openlayers javascript and therefore Openlayers thinks the height and width
of the #map div are undefined (or zero?). It therefore renders the
#map_OpenLayers_ViewPort div with a zero height.

I tried solving this by setting the height and width of the #map div through
javascript (not a really elegant solution, I'd rather do it through css and
without too much additional markup in the html), but didn't get it to work.

I read the  http://n2.nabble.com/Map-size-without-javascript-td2661939.html
thread by Ian Gibson , but the solution he found doesn't seem to work for
me.

Does anyone here have a possible solution to this issue? If not possible by
CSS then Javascript will have to do. Many thanks in advance for any help.

Best regards,
Martijn Senden.
-- 
View this message in context: http://n2.nabble.com/%27Fluid%27-map-in-IE-tp2674997p2674997.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list