标签:上下 解决办法 otto 记录 div 情况 bottom event pre
做微信手机端开发,有时候页面内容一屏就能显示下,这样的情况下就不需要页面能上下滑动,解决办法记录如下:
安卓手机:只需添加样式即可:
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>
标签:上下 解决办法 otto 记录 div 情况 bottom event pre
原文地址:https://www.cnblogs.com/chunyansong/p/9087456.html