Leaflet.awesome-markers icon indicating copy to clipboard operation
Leaflet.awesome-markers copied to clipboard

Foolish mouse over/out events

Open leplatrem opened this issue 12 years ago • 3 comments

I noticed that too many mouseout and mouseover events were triggered on Awesome markers, especially while moving the mouse on top of them.

Steps to reproduce:

  • Setup .on('mouseover', function (){console.log('over')}).on('mouseout', function () {console.log('out')})
  • Move the mouse over the marker and notice the gust !

Basic markers do not behave this way.

leplatrem avatar Apr 07 '13 12:04 leplatrem

Yeah, it's firing for both the div and i tags. I'll see what I can do.

snkashis avatar Apr 20 '13 16:04 snkashis

Any update?

SunSha avatar Feb 04 '14 14:02 SunSha

I have this issue and I don't think there is anything awesome-markers can do, since mouseover and mouseout trigger whenever the element or any child element get hovered over. (look at http://jsfiddle.net/ZCWvJ/7/ & http://stackoverflow.com/a/7286680/341692)

Since the font icon is a child of the larger marker, this will always end up being the case.

a work around that i found is listening to the mouseenter and mouseleave events using jquery instead. Obviously not ideal, but better than nothing.

var marker = L.marker(value.latlng, {icon: icon}).addTo(map);
$(marker._icon).on('mouseenter', function (e) {});
$(marker._icon).on('mouseleave', function (e) {});

If you're trying to popup the popover on hover like me you'll have to additionally offset the popup (src: http://stackoverflow.com/a/21456231/341692)

hajpoj avatar Sep 16 '14 00:09 hajpoj