How to center map on marker and open marker's InfoWindow in one method
Posted
by sMariusz
on Stack Overflow
See other posts from Stack Overflow
or by sMariusz
Published on 2010-01-27T12:22:45Z
Indexed on
2010/03/30
11:03 UTC
Read the original article
Hit count: 329
I'm using Google Map APIv2. On my webpage I've a sidebar containing a list of markers with onclick event executing showDetails method, that looks like:
GMarker.prototype.showDetails=function() {
map.panTo(this.getLatLng());
this.openInfoWindowHtml(this.details);
};
The problem is that i cannot both panTo and openInfoWindowHtml in one method, it pans but won't open tooltip and when i change method to:
GMarker.prototype.showDetails=function() {
this.openInfoWindowHtml(this.details);
map.panTo(this.getLatLng());
};
it opens tooltip but won't center map to the marker's anchor coordinates.
Even using wait function doesn't solve my problem.
What am I doing wrong?
© Stack Overflow or respective owner