昨天接到客户反馈,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 事件(类似鼠标移动上去),第二次才是点击事件。

相关文章:

  • 2022-12-23
  • 2021-07-08
  • 2022-12-23
  • 2021-05-26
  • 2021-09-07
  • 2021-10-19
  • 2021-10-29
猜你喜欢
  • 2022-12-23
  • 2021-04-22
  • 2021-10-29
  • 2021-10-29
  • 2021-09-19
  • 2022-12-23
  • 2021-10-13
相关资源
相似解决方案