Leaflet Mouseout called on MouseOver event

css, javascript, jquery, leaflet, popup

Solution

I know it's an old thread but I've just came across this issue and I thought that I can share my solution. Instead of offsetting the popup, I am preventing the popup from stealing the mouse event using CSS by setting:

.my-popup {pointer-events: none;}

and assigning my-popup className to the popup:

Marker.on('mouseover', function () {Marker.bindPopup('HI', {className: 'my-popup'}).openPopup();})

I hope this helps someone :)

Problem

I have a leaflet map where I'm dynamically adding markers. I want to call the popup for a marker when I hover over it in addition to when I click the marker. My code is: ``` function makeMarker(){ var Marker = L.marker... Marker.on('mouseover', function(){Marker.bindPopup('HI').openPopup();}); Marker.on('mouseout', function(){Marker.closePopup();}); } ``` If I comment out the mouseout line, then the popup appears but then I have to click elswhere to close it. The problem is when I put in the mouseout, at that point, the cursor kinda flickers when it hovers over the marker and nothing shows. I think that the popup is openning but then closing really fast which is why the cursor flickers but I don't know how to fix this

Original source