Replies: 1 comment
-
I worked out a way to make this work, not sure if this is the best way, but it works. And I don't need to keep a reference of the popup content. Adding answer in case it helps someone else. // Make unclickable // Make clickable again |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have several different GeoJSON layers loaded on my map. I want the end user to be able to drop a marker via a click, on top of these GeoJSON layers, but the click events for the binded popup on the GeoJSON features are displaying instead.
How can I temporarily remove the 'click' event for all GeoJSON layers/features for the binded popup, but keep a reference of them, so I can add them back on after the user has dropped their marker?
Here is how I am adding the GeoJSON layers.
function onEachFeature(feature, layer) {
var iwContent = 'Some Value 1';
const contentString = '
layer.bindPopup(contentString);
}
datalayer1 = L.geoJSON(geojson, {
pointToLayer: function(feature, latlng) {
return L.circleMarker(latlng, geojsonMarkerOptions);
},
onEachFeature: onEachFeature
}).addTo(map);
Beta Was this translation helpful? Give feedback.
All reactions