I have the following code for placing several markers on a google map.
What I now want to do is when the user clicks on a marker it zooms in and then centers the map to
google.maps.event.addListener(marker, "click", function (evt) {
infowindow.setContent(this.html);
infowindow.open(map, this);
map.setCenter(evt.latLng);
map.setZoom(10);
});
that will working in my own app
marker is left pointing to the last marker added. Either use function closure or "this" like you did for the infowindow:
google.maps.event.addListener(marker, "click", function () {
infowindow.setContent(this.html);
infowindow.open(map, this);
map.setCenter(this.getPosition());
map.setZoom(10);
});