手机屏幕 .get mobile 最小 按钮 win 设置 rip fixed
- 需要这段代码的背景:
- h5网页嵌入嵌入原生APP中时,在某些机型(如小米4),当页面高度不足慢一屏时,position: fixed;
- bottom: 0d的“按钮”会被遮住,所以需要给页面body设置足够高的最小高度值(min - height),将页面撑高。或者使用如下代码,将html的最小高度值设置为当前手机屏幕的高度。
- < script >
- var mobileHeight = window.innerHeight + "px";
- document.getElementsByTagName(‘html‘)[0].style.minHeight = mobileHeight; < /script>/
js 获取手机屏幕高度的代码
手机屏幕 .get mobile 最小 按钮 win 设置 rip fixed
原文:http://www.cnblogs.com/ishuanghe/p/7990120.html
来源: http://www.bubuko.com/infodetail-2418817.html