Saturday, 31 October 2015

leaflet-> enable/disable statement "easybutton"


I am using EasyButton plugin of leaflet (link). More specifically I applied EasyBar which unites several buttons.
Plus, at certain zoom levels, I add/remove various layers with zoomend function (link). Is it possible to apply a function in which I can refer to BOTH button and zoom level? I don't know the formal code way but the idea something like the following:



  map.on('zoomend', onZoomend);
function onZoomend(){
if(map.getZoom()<8) else if btn2.enable(){}};

**and here is my code:


map.on('zoomend', onZoomend);
function onZoomend(){

if(map.getZoom()<8)(){
map.addControl(info0);

map.removeControl(info1);
map.removeControl(info2);
map.removeControl(info3);
}

if(map.getZoom()==8){
map.addControl(info1);
map.removeControl(info2);
map.removeControl(info3);
} };



No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...