关键代码

  document.getElementById("searchInputbox").addEventListener('touchmove', handler, {passive: false});
  function handler() {
    event.preventDefault();
  }
  var contentBox=document.getElementById("contentBox")
  contentBox.ontouchstart = function() {
      document.getElementById("inputForm").blur()
  } 

 

如果contentBox盒子滚动,则收起键盘,避免键盘导致fixed定位失效

 

源码地址:https://github.com/zuobaiquan/javascript/tree/master/ios端position为fixed失效的解决办法

预览地址:http://zuobaiquan.com/javascript/ios端position为fixed失效的解决办法

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-15
  • 2022-12-23
猜你喜欢
  • 2021-10-25
  • 2022-12-23
  • 2021-06-09
  • 2021-08-09
  • 2021-09-16
  • 2021-09-12
  • 2022-12-23
相关资源
相似解决方案