我正在使用Google Map APIv2。 在我的網頁我已經含有onclick事件執行showDetails方法標記列表的側邊欄,看起來像:如何在標記上集中地圖並以一種方法打開標記的InfoWindow
GMarker.prototype.showDetails=function() { map.panTo(this.getLatLng()); this.openInfoWindowHtml(this.details); };
的問題是,我不能啞劇和openInfoWindowHtml在一個方法兩種,它平移但不會打開工具提示,當我將方法更改爲:
GMarker.prototype.showDetails=function() { this.openInfoWindowHtml(this.details); map.panTo(this.getLatLng()); };
它會打開工具提示,但不會將地圖居中放置到標記的錨點座標。 即使使用等待功能也不能解決我的問題。 我在做什麼錯?