微信手机端禁止页面上下滑动
时间:2018-05-25 13:41:05
收藏:0
阅读:369
做微信手机端开发,有时候页面内容一屏就能显示下,这样的情况下就不需要页面能上下滑动,解决办法记录如下:
安卓手机:只需添加样式即可:
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>
评论(0)