chunyansong

做微信手机端开发,有时候页面内容一屏就能显示下,这样的情况下就不需要页面能上下滑动,解决办法记录如下:

安卓手机:只需添加样式即可:

body, html {
  position: fixed;
  top: 0px;
  bottom: 0px;
  width: 100%;
  height: 100%;
}

苹果手机需要监听touchmove事件

<script type="text/javascript">
  document.body.addEventListener("touchmove",function(event){
    event.preventDefault();
  });
</script>

分类:

技术点:

相关文章:

  • 2021-12-04
  • 2021-12-17
  • 2021-11-26
  • 2022-02-08
  • 2022-01-21
  • 2022-02-04
  • 2021-05-17
  • 2022-12-23
猜你喜欢
  • 2021-11-28
  • 2022-12-23
  • 2021-05-25
  • 2022-12-23
  • 2022-12-23
  • 2021-11-26
  • 2021-11-28
相关资源
相似解决方案