AW: [OpenLayers-Users] Simple Function for deactive all overlays

Arnd Wippermann arnd.wippermann at web.de
Thu Jun 23 10:39:12 EDT 2011


Hi, 

Try this

function setOverlaysVisibility(flag)
{
    var layers = map.layers;
    for(var i=0, len=layers.length; i<len; i++) 
    {
        var layer = layers[i];
        var baseLayer = layer.isBaseLayer;
    
        if(!baseLayer)
            layer.setVisibility(flag);
    }
}        
setOverlaysVisibility(true); //or false

Arnd 

-----Ursprüngliche Nachricht-----
Von: openlayers-users-bounces at lists.osgeo.org
[mailto:openlayers-users-bounces at lists.osgeo.org] Im Auftrag von Jan
Tappenbeck
Gesendet: Donnerstag, 23. Juni 2011 10:48
An: users at openlayers.org
Betreff: [OpenLayers-Users] Simple Function for deactive all overlays



   hi !

i search a simple function to de/active all overlays by a function like
foreach ....

can anybody help me ?

regards Jan :-)

_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users



More information about the Users mailing list