前几天,一位同事在微信上测试一个JQuery的写的购物车功能,出现了一个很奇怪的现象,在android系统上可以正常绑定,但是在iOS上确不能用,经过排除分析,发现其使用了jquery的$(document).click()的方法进行绑定,导致了iOS上是不认,也就说没有这个方法存在。

然后我在老外的一篇文章上找了解决方法:

Change this:

$(document).click( function () {

To this

$(document).on('click touchstart', function () {

Tada!

使用$(document).on('click touchstart', function () {这个是能完美解决的,所以我猜测:在iOS上touchstart的事件覆盖了click!

以下是原文:

http://stackoverflow.com/questions/3705937/document-click-not-working-correctly-on-iphone-jquery

 在此记录一下。

相关文章:

  • 2021-04-08
  • 2021-08-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-03
  • 2021-08-27
  • 2022-12-23
  • 2021-11-19
  • 2021-11-16
  • 2021-10-19
  • 2021-03-31
相关资源
相似解决方案