IOS下document添加一个click事件不触发,不会失去焦点,导致点击input框外的其它地方不会自动消失键盘,还有就是双击其它空白地方会导致整个页面上移

既然click不能触发,可以用移动端的touch事件进行:

ontouchstart
ontouchmove
ontouchend
ontouchcancel

 

判断当前点击的元素是不是在输入框上,不是就调用blur()方法主动失去焦点即可。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-19
  • 2021-10-23
  • 2017-12-12
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-26
  • 2022-12-23
  • 2022-12-23
  • 2022-01-19
相关资源
相似解决方案