[OpenLayers-Users] Map not visible when hidden div is unhidden

Andreas Hocevar ahocevar at opengeo.org
Fri Mar 5 06:39:56 EST 2010


On 2010-03-04 11:11, Zer wrote:
> I have a map in a div within a table cell that is hidden (<td id=map
> style=”display: none;”>) when the page loads. When the user clicks a button,
> the table cell is unhidden by a java script. 
>
> All the scripts that set up the map runs ok when the page is loaded and the
> wfs-calls to Goeserver work fine. 
>
> When the user clicks the button, and the map is visible, the base layers
> (wms) and the wfs-layers are not visible. Instead there is a white tile in
> the upper left corner. The zoom controls and layers switcher are visible. 
> Is soon as the map is moved by just a few pixles, all the wms-tiles are
> loaded from the server and the wfs-layer is shown. 
>
> Is it by design, that the base layers will not load in a hidden element? If
> so, does anyone have a solution to this problem? I really don’t want the
> user to have to move the map in order to show the layers.
>   

Try to call map.updateSize() after making the cell visible.

Regards,
Andreas.

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




More information about the Users mailing list