我正在Phonegap 上构建一个移动应用程序,实现jQuery Mobile。我正在黑莓、Ios 和 Android 上构建相同的应用程序。Ios 和 Android 谷歌地图按预期工作:您可以单击地图,我有一个事件侦听器在该事件上调用网络服务。但在黑莓上,地图不可滚动(已修复)且地图不可点击。有任何想法吗?
我的框架很广泛,但相关代码如下:
GpsLinkClicked: function()
{
kmTolerance="100";
model.getLocation();
setTimeout(function()
{
doneWithSections=app.save("doneWithSections", '');
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "http://maps.googleapis.com/maps/api/js?key=mykeyishere&sensor=false&callback=model.initializeMap";
document.body.appendChild(script);
},1000);
},
initializeMap: function()
{
currentLocation=app.get('currentLocation');
currentLocation=$.parseJSON(currentLocation);
var myLatlng = new google.maps.LatLng(currentLocation.latitude, currentLocation.longitude);
var mapOptions = {
zoom: 16,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("content-dataview"), mapOptions);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title:"My Location"
});
google.maps.event.addListener(map, 'click', function(event) {
model.mapClicked(event.latLng);
});
$("#content-dataview").attr("style", "height: 480px");
$("#content-dataview").trigger( "updatelayout" );
},
mapClicked: function(location)
{
loc=JSON.stringify(location);
locObj=$.parseJSON(loc);
var data={
latitude: locObj.kb,
longitude: locObj.lb,
kmTolerance: "0.2"
};
model.callAjax("GetLookupsWithGps", "POST", JSON.stringify(data));
},