I want to modified the offset of a CircleMarker's popup (I use geojson datas)
var geojsonLayer = new L.GeoJSON(null, {
pointToLayer: function (latlng){
return new L.CircleMarker(latlng, {
radius: 8,
fillColor: "#ff7800",
color: "#000",
weight: 1,
opacity: 1,
fillOpacity: 0.8
});
}
});
geojsonLayer.on("featureparse", function (e) {
var popupContent = e.properties.popupContent;
e.layer.bindPopup(popupContent);
});
map.addLayer(geojsonLayer);
I didn't find where to add the offset : I tried in bindPopup (after popupContent) but it's not working.
e.layer.bindPopup(popupContent,(10,10));
Someone can help me?
Try this:
e.layer.bindPopup(popupContent, {offset: new L.Point(10, 10)})
Thanks a lot!
Nice! Thanks!
IS there a way to dynamically reset the offset? I am trying a variable for offset that is set on a map zoom, but it doesn't seem to work..thanks!
@mourner You just saved my day!!
Most helpful comment
Try this: