2016-08-08 49 views
2

Ich habe Prospektkarte mit Clustergruppe und es funktioniert gut. Ich möchte Popup bei Clustergruppenklick öffnen. On-end-Marker (Element) onclick popup ist gut in Ordnung.Wie Popup auf Klickfliegenclustergruppe zeigen

Ich bin in der Lage, Clustergruppe Klickereignis zu erfassen, aber nicht in der Lage, Popup zu öffnen.

//To create cluster 
      this.markers = L.markerClusterGroup(); 

      //On cluster click get all children 
      this.markers.on('clusterclick', function (a) { 
      this.getClusterData(a.layer.getAllChildMarkers()); 
      //All children is available of cluster when clicked 
     },this); 

Aber nicht Popup öffnen können.

+0

Mögliche Duplikat [Popup auf schwebt über Clustergruppe] (http://stackoverflow.com/questions/32067832/popup-on-hovering-over-cluster-group) – saluce

Antwort

0

Ich fand Lösung here. Vielleicht wird es jemand anderen helfen. Ich verschwendete ganzen Tag

cluster.on('clustermouseover', function(c) { 
      var popup = L.popup() 
       .setLatLng(c.layer.getLatLng()) 
       .setContent(c.layer._childCount +' Locations(click to Zoom)') 
       .openOn(map); 
      }).on('clustermouseout',function(c){ 
       map.closePopup(); 
      }).on('clusterclick',function(c){ 
       map.closePopup(); 
      });