I'm using this function in Mapbox with geoJson to use styled markers from simplestyle
var groupThree = new L.LayerGroup();
L.geoJson(layerThree, {
pointToLayer: L.mapbox.marker.style,
style: function (feature) {
return feature.properties;
}
}, {
onEachFeature: onEachFeature
}).addTo(groupThree);
But when I run it, I can't get a popup to appear when I click on the marker. Here's the function for popupContent:
var popupContent = "";
function onEachFeature(feature, layer) {
if (feature.properties && feature.properties.popupContent) {
popupContent = feature.properties.popupContent;
}
layer.bindPopup(popupContent);
}
Here's my fiddle showing markers without simplestyle that have working popups, and markers with simplestyle whose popups aren't working.
Are pointToLayer and onEachFeature interfering somehow? How can I make it work?