google map loaded event

Google Map 載入是需要時間的,例如你想在載入之後得到地圖的邊界,你可能會用

然後你就會得到 map.getBounds().getNorthEast() 未定義的錯誤訊息。

解決方法是用map的idle這個事件。

依Google Map API的說明[1], idle的意義如下:

idle
Arguments:  None
This event is fired when the map becomes idle after panning or zooming.

參考資料

[1] https://developers.google.com/maps/documentation/javascript/reference?hl=zh-tw#MapOptions

One comment

  1. One thing I’d like to convey is always that auto insurance cancelling is really a dreaded experience and if you are undertaking the right issues being a driver you’ll not obtain one. A lot of people carry out obtain recognize that they are technically dropped simply by their insurance provider they must struggle to obtain more insurance coverage after a cancellations. Inexpensive auto insurance rates are generally hard to get after having a cancelling. Knowing the main reasons concerning the auto insurance termination will help people prevent getting rid of in probably the most significant privileges available. Just strategies contributed by means of your blog.

Leave a Reply

你的電子郵件位址並不會被公開。 必要欄位標記為 *