I'm trying to do something that I can't seem to find any examples of somebody having done before, and I need a little help.
I'm trying to use a element as an alternative to an InfoWindow. When you click a marker I want a div to appear instead of the infoWindow.
I already know how to make divs appear, I just need to figure out how to tie that to Google Maps/Marker Events.
The current chunk of code that I know;
google.maps.event.addListener(marker, 'click', (function(marker) {
return function() {
map.panTo(marker.getPosition());
map.panBy(m_w_pan,0);
}
})(marker));
addresses all markers on the map. If I remember correctly, removing the )(marker));
at the end makes it so that the code only references one marker, but how do I know which marker it relates to/pick the marker I want to tie the Event to?
Using a marker array (sample):
var memory = [
['A', 37.769587, -122.444344, 1],
['B', 37.769587, -122.454344, 2],
['C', 37.769587, -122.464344, 3],
['D', 37.769587, -122.474344, 4],
['E', 37.769587, -122.484344, 5]
];
How do you specify that you want div 1 to appear when you click marker A, and div 2 to appear when you click marker B, etc?
I hope that makes sense.
Thanks!
EDIT: It seems my question is a bit confusing to people, I'll try to simplify it. How do I add an event to one specific marker out of the array of markers? Is this possible? Everybody is mentioning how to create infowindows for all markers in the array, what I need to do is target one specific marker. Maybe that will make this a little clearer? We'll see.