lennardv2 / Leaflet.awesome-markers

Colorful, iconic & retina-proof markers for Leaflet, based on the Font Awesome/Twitter Bootstrap icons.
MIT License
1.27k stars 340 forks source link

awesome-markers and click #81

Open powpowland opened 7 years ago

powpowland commented 7 years ago

Hello,

I need an action when I click on a marker but I have that error : TypeError: listeners[i].action is undefined

This is my code :

var mark1 = L.marker([45.21996,6.22247], {icon: L.AwesomeMarkers.icon({icon: 'glass', prefix: 'fa', markerColor: 'red'}) });
        mark1.addTo(map).bindPopup("<b>You're here</b>");
        var mark2 = L.marker([45.21763,6.21749], {icon: L.AwesomeMarkers.icon({icon: 'glass', prefix: 'fa', markerColor: 'gray'}) });
        mark2.addTo(map).bindPopup("<b>You're not here</b>");

function onMarkerClick(text) {
                    alert('test '+text);
                }

        mark1.on('click', onMarkerClick('abc'));
        mark2.on('click', onMarkerClick('efg'));

Could you help me please ?

johncadengo commented 5 years ago

@powpowland did you ever get this to work?