title: Is there a way to change the icon image depending on the zoom level? (leaflet.js)
body: <p>I am making a region drawing tool for a web application and I am using markers as anchors that the user can use to change the shape of a polygon. </p>
  
  <p>This is what I have so far. <a href="http://demos.nodeline.com/leaflet_development/" rel="noreferrer">http://demos.nodeline.com/leaflet_development/</a></p>
  
  <p>the repo is at <a href="https://github.com/SpencerCooley/Leaflet_development" rel="noreferrer">https://github.com/SpencerCooley/Leaflet_development</a> </p>
  
  <pre><code>$(document).ready(function(){
  
  var map, cloudmade, sanAntonio, polygonPoints  
  
  
   map = new L.Map('map');
  
   cloudmade = new L.TileLayer('http://{s}.tile.cloudmade.com/d4334cd6077140e3b92ccfae2b363070/997/256/{z}/{x}/{y}.png', {
      attribution: 'Map data &amp;copy; &lt;a href="http://openstreetmap.org"&gt;OpenStreetMap&lt;/a&gt; contributors, &lt;a href="http://creativecommons.org/licenses/by-sa/2.0/"&gt;CC-BY-SA&lt;/a&gt;, Imagery © &lt;a href="http://cloudmade.com"&gt;CloudMade&lt;/a&gt;',
      maxZoom: 18
  });
  
  
   sanAntonio = new L.LatLng(29.4238889, -98.4933333); // geographical point (longitude and latitude)
  
  
   map.setView(sanAntonio, 13).addLayer(cloudmade);
  
  
  
  
  polygonPoints = [];
  
  var polygon = new L.Polygon(polygonPoints);
  map.addLayer(polygon);
  
  map.on('click', function(e) {  
  
  
    var marker = new L.Marker(e.latlng, {draggable:true});
    polygonPoints.push(e.latlng);
    var markerId = polygonPoints.length -1 
    map.addLayer(marker);
    polygon.setLatLngs(polygonPoints);
  
  
  
    marker.on('drag', function(){
      var locationWhileDrag = marker.getLatLng();
      $('#first_marker').val(locationWhileDrag);
      polygonPoints.splice(markerId,1,locationWhileDrag);
      polygon.setLatLngs(polygonPoints);
    });      
  
  
  
  });
  
  
  
  
  
  
  
  });
  </code></pre>
  
  <p>I only want the markers to be normal size when the user is zoomed in to street level. When you zoom out the normal sized markers completely drown out the polygon. I looked through the docs but couldn't find anything about this.</p>
  
  <p>I am mainly looking for suggestions/brainstorming. I am thinking maybe there is a way to detect which zoom state you are currently in? If so, I could use an if statement to change the icon.</p>