iOS不识别点击事件

iOS不识别点击事件

本文介绍了iOS不识别点击事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用jQuery创建一个交互式地图。如果您点击地图左侧的6个位置中的任意一个,地图将会对其进行平移,并且标记会显示带有其名称的标签。我知道我的代码很杂乱,但这只是用于演示目的。到目前为止,它的所有工作正常:





它们是一些附加功能。当你点击地图本身的一个标记时,名称应该出现在标记上,而地图左侧的位置名称应该变为粗体。这发生在Firefox和Chrome上,但iPad和iPhone上没有任何反应。

我已阅读了关于在iOS上使用jQuery的实况的问题,但是我试图在没有运气的情况下使用这些解决方法。感谢


解决方案

更改事件侦听器 点击 到 点击touchstart 固定这一点。

Im using jQuery to create an interactive map. If you click on any of the 6 locations to the left of the map, the map will pan to them and a label with their name appears by the marker. I know my code is quite messy but this is for demo purposes only. So far its all working fine:

http://smartpeopletalkfast.co.uk/gmap2/

Their is some additional functionality. When you click on a marker in the map itself, the name should appear by the marker, and the location name to the left of the map should become bold. This is happening on firefox and chrome but nothing happens on iPad and iPhone.

Ive read about issues with using jQuery's live on iOS but ive tried the workarounds without luck. Thanks

解决方案

Changing the event listener "click" to "click touchstart" fixed this.

这篇关于iOS不识别点击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 17:48