Edit: Oh! misunderstood your question. Yes, the problem is that you do L.geoJson twice and do different things with them. This function returns a new L.GeoJson object, so the things you add your pop-ups to are not what you do with custom markers. So yes, you should just combine them.
var geoJson = L.geoJson(geoJsonData, { pointToLayer: function(obj) { var mark = L.circleMarker(obj.geometry.coordinates, obj.properties); mark.bindPopup('<div>' + marks.length + '</div>'); return mark; } });
This code snippet is from and updated, I did here .
I will leave a bit below about custom cluster icons.
As a side note, it is usually bad practice to try to create two vars of the same name, and most linter will complain about it.
...
I created a small demo that uses clustering, pop-ups, and custom icons here .
When you create a MarkerClusterGroup, you can give it an arbitrary function with icon creation for clusters:
iconCreateFunction: function(cluster) { var count = cluster.getChildCount(); return L.divIcon({ html: '<span class="custom">' + (count + 100) + '</span>' }) }
Where you can put your logic for custom cluster icons. For single markers, you can pass the icon directly to the constructor. You will also notice that pop-ups work for markers and clusters.
EDIT: previous jsfiddles are now incompatible with booklet and bullet versions. Here is the working version
Hope this helps!
hassassin
source share