2012-08-27 27 views
0

這可能不是這個問題的最佳場所,但這裏有雲:的GoogleMaps API3,demogallery例如「自定義小導航控制」

我在Google地圖初學者和javascript,發現這個例子的東西我工作。 http://search.missouristate.edu/map/mobile/examples/ZoomPanControl.htm 我瞭解大部分的代碼,但我有一個困難時期,在這個文件ZoomPanControl.js

window["missouristate"] = window["missouristate"] || {}; 
window["missouristate"]["web"] = window["missouristate"]["web"] || {}; 
window["missouristate"]["web"]["ZoomPanControl"] = ZoomPanControl; 

編輯結束找出下面的代碼行的含義:original example是不再可用,並重定向到一個地圖,沒有自定義ZoomPanControl,here is an example that shows the custom zoom/pan control referenced

回答

0

它附加的控制全局變量「窗口」,這樣您就可以使用它實例化(或命名空間):

var ZoomPanControl = new missouristate.web.ZoomPanControl(map); 

Google Maps API loader做同樣的事情,即:

window.google = window.google || {}; 
google.maps = google.maps || {}; 
+0

謝謝,這有助於一些,我想我需要閱讀更多有關DOM以及如何命名空間的工作。 – scott

相關問題