有沒有在地圖加載標記時有加載圖標的方法?我正在使用谷歌地圖API 3與JavaScript和無法找到這方面的信息。Google Maps API 3加載圖標
0
A
回答
2
如果您使用KmlLayer對象加載標記,則可以將偵聽器附加到事件metadata_changed
,該事件在KmlLayer加載完所有信息後觸發。
因此,您可以在初始化地圖後立即顯示自定義加載圖標,然後使用new google.maps.KmlLayer(...)
撥打標記。在metadata_changed
的收聽者中,您可以刪除自定義加載圖標,或者將其隱藏顯示。所以當KmlLayer完成加載時,它會運行代碼來刪除您的加載圖標。
您可以通過添加監聽:
google.maps.event.addListener(kmlLayerObject, 'metadata_changed', function() {
...
}
1
你也「躲」在地圖的加載DIV帆布,並顯示初始化之後。
另外一點需要注意的是,當在地圖隱藏上的init,它可以運行異常,可以固定通過「調整」地圖:
2
這個事件現在被稱爲「status_changed 「每個API文檔:https://developers.google.com/maps/documentation/javascript/reference#KmlLayer
它可以像這樣使用:
google.maps.event.addListener(kmlLayer, 'status_changed', function() {
if (kmlLayer.getStatus() == google.maps.KmlLayerStatus.OK) {
// Success
}
else {
// Failure
}
});
相關問題
- 1. Google Maps API 3
- 2. google-maps-api-3
- 3. Google Maps API V3 - 首先加載地圖,然後加載標記
- 4. Google Maps API:動態加載標記
- 5. Google Maps API V3標記不加載
- 6. Google Maps API - 加載美國
- 7. Google maps API無法加載?
- 8. Google Maps API v3 - 無法加載地圖
- 9. Google Maps API 3 referrerNotAllowedMapError
- 10. Google Maps API 3&jQTouch
- 11. Google Maps API v3添加地圖標記
- 12. Google Maps Api添加標籤
- 13. Android和Google Maps API - 圖標
- 14. Google Maps API 3 Javascript添加多邊形
- 15. Google Maps API - 標記
- 16. Google Maps API 3,c#MVC5
- 17. Google Maps Api版本3
- 18. Google Maps API 3怪異
- 19. Google Maps API 3搜索框
- 20. Text Layer google-maps-api-3
- 21. Google Maps API v2街景標記圖標
- 22. Google maps API cusom圖標(不是圖片)
- 23. Google Maps API加密
- 24. Google Maps API標記標題
- 25. Google Maps API圖像
- 26. Android Google Maps圖標
- 27. Google Maps API - 緩慢加載javascript
- 28. Google Maps API(JS V3) - 逐行加載
- 29. 在HtmlService中加載Google Maps API GAS
- 30. AngularJS,加載Google Maps API時暫停
這事件不是谷歌地圖API文檔中列出(HTT PS://developers.google.com/maps/documentation/javascript/events)。未記錄的功能?也許不支持? – 2015-04-10 10:16:59
@JoseGómez - 我在https://developers.google.com/maps/documentation/javascript/reference中查看了google.maps.event命名空間。雖然,他們可能會改變它,因爲我的答案是4歲。 – Tony 2015-04-15 06:13:24