0

我还有另一个问题需要解决,因为它很烦人。我已经在一个应用程序上工作了一段时间,我设法让它很好地工作。

具体来说,谷歌地图功能应该有出现的标记,当你点击它们时,屏幕应该放大并显示一些关于标记的信息。现在,我已经编写了代码,当您在 Chrome 上测试它时,它可以完美运行。但是当我尝试将它移植到标签设备本身(Samsun Galaxy)时,每当我尝试触摸标记时都没有任何活动。

我对此感到困惑和恼火,因为触摸标记的动作应该与使用鼠标单击它相同,我没有弄错吗?我想知道是否有其他人可以在这方面给我任何帮助,因为这是一件小事,对我造成了极大的麻烦。

我在下面添加的代码:

var marker_icon = new google.maps.MarkerImage('images/map/' + thisIcon + '.png', new google.maps.Size(32, 32));

trafficMarker = new google.maps.Marker({
  position: new google.maps.LatLng(TrfAl.lat, TrfAl.lon),
  animation: google.maps.Animation.DROP,
  map: mapPanel,
  icon: marker_icon,
  id: 'trafficAlertPanel' + i,
  componentId: 'trafficAlertPanel' + i,
});
markerArray[i]=trafficMarker;

google.maps.event.addListener(trafficMarker, 'click', function(){
  console.log('clicked!');
  LoadIncidentMap(this.id.substring(17));
});
4

1 回答 1

0

出于某种原因,点击事件不会在 android 和 iOS 上触发。一种解决方法是改用“mousedown”事件,该事件将在点击时触发。

google.maps.event.addListener(trafficMarker, 'mousedown', function(){
    console.log('clicked!');
    LoadIncidentMap(this.id.substring(17));
});
于 2011-10-09T15:39:34.320 回答