最近在写H5项目,遇到了一个问题,ios滚动条回弹,要求是不要整个网页回弹

因为IOS自带回弹效果  

  -webkit-overflow-scrolling: touch;

 会导致页面滚动条不灵敏的问题

在不需要回弹效果的元素设置

html, body {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
}
然后在JS中设置
    document.body.addEventListener('touchmove',(e:any)=>{
      document.body.scrollTop = 0;
   })

相关文章:

  • 2022-01-24
  • 2022-02-04
  • 2021-12-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-08
  • 2022-12-23
  • 2021-11-18
  • 2021-11-18
  • 2021-07-10
  • 2022-12-23
  • 2021-10-22
相关资源
相似解决方案