title: Leaflet marker click callback on spiderfy
body: <p>Using the great spiderfier of George MacKerron <a href="https://github.com/jawj/OverlappingMarkerSpiderfier-Leaflet" rel="nofollow">https://github.com/jawj/OverlappingMarkerSpiderfier-Leaflet</a>
  there is a problem.</p>
  
  <p>When clicked on a pin, the popup of it is showing up. That´s cool, as long as I don´t have overlapping pins, which I spiderfy.
  The problem with spiderfied pins is the popup, which opens on the first click too, while it overlaps certain other pins of the spiderfied set.</p>
  
  <p>Therefore, I need a click callback on the spiderfy-listener, which allows me to close the popup immediately after spiderfying. Or even better, directly before spiderfying the set.</p>
  
  <p>The question is: How can I achieve a callback on the spiderfy-listener? Well, maybe its dumb to do it on that one, in that case please tell me what to do else. Thanks :)</p>
  
  <p>My code which uses a whacky 20ms hack at the bottom, I don´t want to keep:</p>
  
  <pre><code>    // Kartendarstellung mit Spiderfier
      var map = L.map('basicMap').setView(new L.LatLng(position[0][0], position[0][1]), 13);
      map.doubleClickZoom.disable(); 
      var oms = new OverlappingMarkerSpiderfier(map, {
          keepSpiderfied: true,
          nearbyDistance: 25,
          legWeight: 2
      });
  
      L.tileLayer('http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png', {
          maxZoom: 18,
          attribution: 'Kartendaten &amp;copy; &lt;a href="http://openstreetmap.org"&gt;OpenStreetMap&lt;/a&gt; und Mitwirkende, Lizenz: &lt;a href="http://creativecommons.org/licenses/by-sa/2.0/"&gt;CC-BY-SA&lt;/a&gt;, Bilddaten © &lt;a href="http://cloudmade.com"&gt;CloudMade&lt;/a&gt;'
      }).addTo(map);    
  
      for (var i = 1; i &lt; &lt;?php echo count($pos);?&gt;; i++){
          switch(position[i][3]){
              case "B":
                  marker = L.marker([position[i][0], position[i][1]],{icon: BIcon}).addTo(map);
                  break;
              case "S":
                  marker = L.marker([position[i][0], position[i][1]],{icon: SIcon}).addTo(map);
                  break;    
          }
          // Marker ungeöffnet auf Karte setzen
          var popup = new L.popup();
          var content = position[i][2];
          // Marker-Inhalt zuweisen
          marker.bindPopup(content);
          // Spiderfier Marker setzen
          oms.addMarker(marker);
      }
  
      oms.addListener('spiderfy', function() {
          // Hack als Ersatz zu fehlendem Spiderfy-Marker-Click-Callback
          setTimeout( function() {
              map.closePopup();
          }, 20);
      });
  </code></pre>