对于在项目中使用的GPS可以用以下
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(
function (position) {
// Did we get the position correctly?
// alert (position.coords.latitude);
// To see everything available in the position.coords array:
// for (key in position.coords) {alert(key)}
mapServiceProvider(position.coords.latitude,position.coords.longitude);
},
// next function is the error callback
function (error)
{
switch(error.code)
{
case error.TIMEOUT:
alert ('Timeout');
break;
case error.POSITION_UNAVAILABLE:
alert ('Position unavailable');
break;
case error.PERMISSION_DENIED:
alert ('Permission denied');
break;
case error.UNKNOWN_ERROR:
alert ('Unknown error');
break;
}
});
}
的代码,可以发现here或phonegap docs 当你有,你可以改变你的 形式值的位置。那么是否使用谷歌地图插件 的问题。我个人并没有使用任何。由于 您正在使用jQuery手机,您可以使用this。
创建在init事件地图(所以你只创建一次),并 触发在pageshow事件resize事件,所以你不会有问题 与地图出现在你的屏幕等 的左上角如果您使用我提到的插件,请查找刷新方法。 地图的容器必须具有大小。如果不是, 将无法正常显示,因为jqm会将最小尺寸 添加到容器中。您可以通过编程(检查窗口高度和宽度)来计算空间(如果存在 标题,则必须将其包含在计算中)。 最后,如果您有在this
感谢您的详细回答变焦看问题。 – farjam
如果这回答了你的问题,你为什么不接受它? http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work/5235#5235 – alkis