2014-09-02 115 views
0

我正在Cordova/Phonegap中創建一個應用程序。我想添加帶有圖像疊加層的Google地圖。我包括地圖腳本MapView.js:谷歌地圖與圖像覆蓋在科爾多瓦/ phonegap

$.getScript('https://maps.googleapis.com/maps/api/js?v=3.exp',function(){ 
    $.getScript('./lib/InitializeMap.js',function(){ 
    }); 
}); 

InitializeMap.js代碼是在這裏:http://pastebin.com/TqjE4CVm

其結果是應用程序只顯示灰色格應包含地圖覆蓋,但沒有圖像既沒有地圖。

在Chrome的控制檯,我得到: Failed to execute 'write' on 'Document': It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened.

我還想補充一點,正常的地圖,而覆蓋與下面的代碼工作:http://pastebin.com/vgtgUzSP

我該如何解決?

回答

1

你想使用我的插件phonegap-googlemaps-plugin

您可以在Android和iOS上使用Google Maps SDK構建您的應用,並輕鬆通過JavaScript控制它。

相關問題