I want to change the outline of a polygon depending on the zoomlevel. I thought it's easy to implement but there must be something wrong. My polygons dissapear when I try it with this code:
to get current zoomlevel:
map.on('zoomend', function() { var currentZoom = map.getZoom(); });
style function to style polygon:
function myStyle(feature) { return { fillColor: '#1c9099', color: 'white', if (currentZoom == 15) { weight: 2 } else { weight: 3 } }; }