How to center map on marker and open marker's InfoWindow in one method
- by sMariusz
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?