移动端web开发注意事项
-
iOS没有滚动条概念,所以overflow:hidden不能禁止页面滚动
解决方案:
1.给body添加touchmove事件
document.body.addEventListener('touchmove', preventDefault); function preventDefault(e){ e.preventDefault(); }
2.给html、body同时加width:100%; height:100%; overflow:hidden;
-
获取浏览器窗口大小使用 window.innerHeight(innerWidth)