Leaflet.awesome-markers
Leaflet.awesome-markers copied to clipboard
Foolish mouse over/out events
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.
Yeah, it's firing for both the div and i tags. I'll see what I can do.
Any update?
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)