IOS上面需要点击两次才跳转页面

昨天接到客户反馈,iOS 设备上链接要点击两次才跳转,解决办法如下: 确保你的HTML页面添加了以下头部代码:

<meta name="viewport" content="width=device-width, initial-scale=1"/>

修改触发事件

$("#xxxx").on('click', function() {
  window.location.href = 'aaa.html'
});

改成:

$("#xxxx").on('click touchend', function() {

  window.location.href = 'aaa.html'
});

问题搞定。

原因:iOS 设备上,如iPhone X,在第一点击时是 hover 事件(类似鼠标移动上去),第二次才是点击事件。

原文地址:https://www.cnblogs.com/digdeep/p/15000519.html