In the following how would I customize the popup options? I want to add in the option for the keepInView to be true.
var myLayer = L.geoJson(polygon, {
onEachFeature: yourOnEachFeatureFunction
}).addTo(map);
function yourOnEachFeatureFunction(feature, layer){
if (feature.properties.name) {
layer.bindPopup(feature.properties.name);
}
}
Best Answer
Check out the Leaflet Documentation.
Here's the bit you want:
You can implement like this:
Or in your example:
(This is passing in an object, which is composed of 'attribute:value' pairs.