javascript - Google Maps with OMS - Marker properties in response to click event -
i'm having bit of problem overlappingmarkerspiderfier google maps api:
near start of script, store of markers in array called "parentnodes". when click on marker, need able detect "id" of marker ("id" property of each marker set whenever initialising them) can run function hides of markers except 1 clicked on.
i've tried adding listener each marker after initialise them, wouldn't recognise array, though it's global, giving me error "parentnodes[i] undefined" whenever clicked on marker.
for(var = 0; < parentnodes.length; i++) { oms.addlistener('click', function() { console.log(parentnodes[i].id); }); }
i thinking better solution have 1 listener, there way of accessing properties of marker if listener doesn't know 1 clicked on , whether or not other markers underneath it? or listener know somehow?
this faq (usually infowindows initialized in loop). "i" greater parentnodes.length, parentnodes[i] undefined.
Comments
Post a Comment