Finished though I have, still, there's a question in my head...

Why do we put an event listener of clicking the marker in the "addMarker" function instead of in the "configure" function?

When we first go to the Mashup page, the program should go to the "configure" function once it's loaded, according to:

// configure UI once Google Map is idle (i.e., loaded)
google.maps.event.addListenerOnce(map, "idle", configure);

In the "configure" function, there are three listeners for drag and zoom since the program will implement different functions when the map is dragged or zoomed. But why not put the listener of the markers here as well?

The "addMarker" function is only called when "update" function is called, then how do the program listens to the click whenever a user clicks?

I'm just not quite understand why the listener of the marker should and "showInfo" function should be placed in "addMarker" function...

Hope someone can help me out about this, Thanks a lot!!

1 Answer 1


As I understand it, each marker has its own listener. So you can't create a listener for a marker you still haven't created. That's the reason in configure you create a new listener for the map AFTER you have created the map. Now with each marker you create you make a listener for a click in this marker too that "listens" for a click as long as the marker exists.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .