CloudMade/Leaflet — Issue #419: Click event stops firing on layer after adding mouseover event
Author: anderser
Created: 2012-01-05 20:27:31+00:00
State: open

I've got a map with markers added by looping through a json file and adding the markers with my add_marker function.

The function also binds som events to the marker/layer on mouseover/out in order to change the icon when the user is hovering the marker. That works ok.

But after I added the mouseover event (with change of the icon), the click event on the same marker does not seem to fire.

Maybe I am missing something essential here, or it might be a bug...

```javascript

function add_marker (index, a) {

latlng = new L.LatLng(a.lat, a.lng)
var m = new L.Marker(latlng, {icon: icon});

m.on('mouseover', function(e) {
m.setIcon(hover_icon);
});

m.on('mouseout', function(e) {
m.setIcon(icon);
});

m.on('click', function(e) {
console.log("click");
});

map.addLayer(m);
}
```