Phonegap:Google地图的SearchBox /自动填充不适用于iOS /移动 [英] Phonegap: Google Maps' SearchBox / Autocomplete NOT Working on iOS / Mobile

查看:308
本文介绍了Phonegap:Google地图的SearchBox /自动填充不适用于iOS /移动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Google Maps APIv3,jQuery 1.9.1,JQuery Mobile 1.3.1和Phonegap 2.9.0,并且使用我的代码: http://jsfiddle.net/vkpWK/ 我相信这三行代码中必须有一些东西:

I am using Google Maps APIv3, jQuery 1.9.1, JQuery Mobile 1.3.1, and Phonegap 2.9.0 and have made a fiddle with my code: http://jsfiddle.net/vkpWK/ I believe there must be something going on in these 3 lines of code:

// 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中,此代码可以正常工作,但当您看到SearchBox的下拉列表中的建议时,您不能点击它们。 。我正在寻找一种方法来获得点击建议实际上激发'places_changed'事件。

In Phonegap this code works, but when you are presented with the SearchBox's dropdown list of suggestions, you cannot click on them. Clicking on them does nothing. I am looking for a way to have the clicks on the suggestions actually fire the 'places_changed' event.

为了使事情变得复杂,这里是踢球者。 。它的工作原理是在台式机和iOS / Android上。你可以点击搜索结果,它的工作原理,地图将更新到新搜索的位置,但它不适用于我在Phonegap。一个坏的感觉,这是不知何故一个CSS问题或者可能一些其他JS监听器是不允许这种情况发生。我如何测试这个理论?

To make things complicated, here is the kicker. This code works. It works as is on desktops and on iOS / Android. You can click on the search results and it works as intended, the map will update to the newly searched location. It does not, however, work for me in Phonegap. I have a bad feeling that this is somehow a CSS issue or maybe some other JS listener is not allowing this to happen. How can I test this theory?

已测试使用google.maps.places.Autocomplete而不是google.maps.places.SearchBox,但它没有帮助。

As an alternative, I have tested using google.maps.places.Autocomplete instead of google.maps.places.SearchBox, but it did not help.

谢谢!

推荐答案

我的 index.html的 < 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>

Also if you are able to see very small fonts and UI, try replacing this <meta> :

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

这篇关于Phonegap:Google地图的SearchBox /自动填充不适用于iOS /移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆