[OpenLayers-Users] Error displaying map in IE8 - VML.js

Andreas Hocevar ahocevar at opengeo.org
Wed Jul 29 12:36:56 EDT 2009


Shawn Oatley wrote:
>   
>>>> On 7/29/2009 at 11:57 AM, Andreas Hocevar <ahocevar at opengeo.org> wrote:
>>>>         
>> soatley wrote:
>>     
>>> In case anyone else runs into this, I found out that after the map is
>>> created, it sometimes doesn't set a height or width value in the map.size
>>> property.  Here's my fix which seems to work quite nicely:
>>>
>>>  map = new OpenLayers.Map('map', options);
>>> if (isNaN(map.size.w) || isNaN(map.size.h)) {
>>>             map.updateSize();
>>>         }
>>>   
>>>       
>> You can also make sure that the container where you render the map in
>> (in your snippet a div or whatever element with id 'map') has a width
>> and height style before you create the map object.
>>
>>     
>
> Andreas, thanks for the tip.  What about when the map is going to be the full screen size?  Would it be best to set an initial value (say 800X800)?  Will the map then go back and update the size to the ful screen?  Or should I specify a size by percent (100%)?
>   

100% should work (untested), but you have to set width and height to
100% on the html and body elements also.

Regards,
Andreas.

> Shawn
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>   


-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.




More information about the Users mailing list