煎茶触摸 ->谷歌地图标记不响应触摸
我还有另一个问题需要解决,因为它相当令人恼火。我开发一个应用程序已经有一段时间了,我设法让它运行良好。
具体来说,谷歌地图功能应该有出现的标记,当您单击它们时,屏幕应该放大并显示有关标记的一些信息。现在,我已经对此进行了编码,当您在 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));
});
I have another question which needs resolving as it is rather irritating. I have been working on an app for a while and i managed to get it working nicely.
Specifically, the google map feature is supposed to have markers which appear and when you click on them, the screen is supposed to zoom in and display some information regarding the marker. Now, I have coded this in and it works perfectly when you test it out on Chrome. But when I tried to port it over to the tab device itself (Samsun Galaxy), there is no activity whenever i try to touch the markers whatsoever.
I am rather baffled and miffed by this, as the action of touching the marker should be the same as clicking on it using a mouse, am I not mistaken? I was wondering if anyone else could give me any help with this, as it is something minor which is causing one hell of a hiccup for me.
The code I have added below:
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));
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于某种原因,在 Android 和 iOS 上点击时不会触发点击事件。一种解决方法是使用“mousedown”事件,该事件将在点击时触发。
For some reason click events don't fire for taps on android and iOS. One work-around is to use the 'mousedown' event instead, which will fire on tap.