Created
January 29, 2014 19:25
-
-
Save patrickarlt/8695036 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// make a feature group to store lots of markers and add it to the map | |
var markers = new L.featureGroup().addTo(map); | |
// listen for clicks on things in the feature group | |
markers.on("click", function(e){ | |
// e.target is the marker which should have an "id" property | |
}); | |
// in theory you do this a bunch of times | |
var marker = new L.marker(latlng, options); | |
marker.id = "something"; // since markers are just javascript objects you can assign whatever you want to it | |
markers.addLayer(marker); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment