3

我正在使用谷歌地圖APIv3,jQuery 1.9.1,JQuery Mobile 1.3.1和Phonegap 2.9.0,並提出了我的代碼小提琴:http://jsfiddle.net/vkpWK/我相信一定有什麼東西在這3行代碼回事:Phonegap:谷歌地圖的搜索框/自動完成不適用於iOS /移動

// Assign Search Box 
input = /** @type {HTMLInputElement} */ (document.getElementById('searchTextField')), 
searchBox = new google.maps.places.SearchBox(input); 

// Event Listener - Move the Map on Search Results 
google.maps.event.addListener(searchBox, 'places_changed', function() { 

在PhoneGap的此代碼的工作,但是當你都帶有的建議搜索框的下拉列表中,你不能點擊。點擊它們什麼都不做。我正在尋找一種方法,讓建議的點擊實際上觸發'places_changed'事件。

使事情變得複雜,這裏是踢球者。此代碼有效。它可以在桌面和iOS/Android上使用。您可以點擊搜索結果並按預期工作,地圖會更新到新搜索的位置。但是,它並不適用於Phonegap中的我。我有一種不好的感覺,這是某種CSS問題,或者其他一些JS偵聽器不允許這種情況發生。我如何測試這個理論?

作爲一種替代方法,我測試了使用google.maps.places.Autocomplete而不是google.maps.places.SearchBox,但它沒有幫助。

謝謝!

+0

等待,讓我試試看! :) – MAST3RMIND

+0

pennstump,這個問題有什麼好運?我今天剛碰到它。在桌面上使用android(使用cordova),但不使用IOS7(使用cordova)。 –

回答

0

我把它在加入這個工作後,我index.html's<head>

<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> 
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" /> 
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> 
<script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script> 

此外,如果你能看到很小的字體和UI,請嘗試更換此<meta>

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, target-densitydpi=medium-dpi, user-scalable=0" />

+0

謝謝!我要給它一個鏡頭。那麼,你添加了jQuery UI包? – pennstump

+0

是啊!這是需要的 – MAST3RMIND

+0

不幸的是,他沒有在我的任何測試設備上爲我解決問題。不過謝謝你。 – pennstump

相關問題