mouseover and mouseout events do not behave like mouseenter and mouseleave on markers
See original GitHub issueAccording to #1144 Leaflets mouseover
and mouseout
should behave like mouseenter
and mouseleave
. However this fiddle shows that this is not the case.
If you move the mouse over the outer ring of the marker the popup shows up but as soon as you enter the inner circle it is closed because mouseout
is fired. If you move back to the outer ring the popup shows up again.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:13 (10 by maintainers)
Top Results From Across the Web
Moving the mouse: mouseover/out, mouseenter/leave
The mouseover event occurs when a mouse pointer comes over an element, and mouseout – when it leaves. These events are special, because...
Read more >Mouseover and Mouseout listener for Google Maps marker
The key is to set animation only when it is not set already, as: google.maps.event.addListener(marker, 'mouseover', function() { if (this.
Read more >MouseEnter and MouseLeave VS. MouseOver and MouseOut
On the surface, MouseEnter and MouseOver seem to do the same thing. However, there is a difference in how they handle event bubbling...
Read more >UI Events - W3C
The mouseover / mouseout events are only fired once, while mouseenter / mouseleave events are fired three times (once to each element).
Read more >Moving the mouse: mouseover/out, mouseenter/leave - W3docs
The mouseover event takes place when the pointer of the mouse comes over an element. On the contrary, the mouseout event occurs when...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For v0.7.7 users having a similar issue and arriving here via google or otherwise, I’ll give my $0.02 on a good way to handle this rather than just offsetting the popup: fiddle.
On a related note, I also wanted to find a way to avoid triggering the mouseout event on a marker when adding a new feature on or around it. In my application, I’m displaying GPS data which has an error radius for each GPS fix. I wanted to be able to mouse over a marker for a given data point and show that error, but I ran into the same issue where adding a layer or showing a popup when mousing over a marker would trigger the marker’s mouseout event.
Here’s a fiddle showing the undesired behavior and how to fix it.
@fminuti Your right it seems that there isn’t really an issue. Now I have the problem that I need to be able to move the mouse over the popup because there are links inside it. But that isn’t really something that leaflet is responsible for so I’ll find some way to work around it in my code.
@yohanboniface feel free to close if you agree that there is no issue in Leaflet.