2013-09-30 176 views

回答

0

根據地圖的hasLayer狀態,您可以保留tooltips添加和刪除gridlayers

if (map.hasLayer(layer)) { 
    map.removeLayer(layer); 
    map.removeLayer(gridlayer); 
    this.className = ''; 
} else { 
    map.addLayer(layer); 
    map.addLayer(gridlayer); 
    this.className = 'active'; 
} 

這是example