I am working on a leaflet map project where I am dynamically adding markers.
One of my goals is to have the marker's popup appear not only when clicked, but also when the user hovers over it.
This is the code snippet I have been using:
function makeMarker(){
var Marker = L.marker...
Marker.on('mouseover', function(){Marker.bindPopup('HI').openPopup();});
Marker.on('mouseout', function(){Marker.closePopup();});
}
However, I encountered an issue. When I comment out the 'mouseout' line, the popup appears but then requires another click elsewhere to close. But when I include the 'mouseout' event, the cursor flickers and nothing shows up when hovering over the marker. It seems like the popup is opening and closing rapidly causing this flickering effect, but I'm unsure how to resolve this issue.