I'm using Leaflet jS for a map and it works well except for a requirement to popup the name of the country when hovering over a country on the map.
On using the following code
layer.on({
mouseover: function over(e) {
layer.bindPopup(L.popup().setContent(feature.properties.name));
layer.openPopup();
},
mouseout: function out(e) {
layer.closePopup();
},
});
The Country name does pop up however it's slightly off in int's location. For example the US when hovered over the popup opens in the Pacific west of Mexico. All popups are slightly off from where the hover has occurred.
Do you know how the popups can be set to popup always directly on the country?
Thanks in advance for any help on this.