mui背景图片全屏方法

来源:互联网 发布:做数据分析有前途吗 编辑:程序博客网 时间:2024/06/05 19:07
.mui-content{position: absolute;width: 100%;height: 100%;background: url(images/welcome_bg.jpg)no-repeat;background-size: 100%100%;}

有输入框时不要将height设为100%(弹出输入法会压缩页面,难看),应为固定值

HTML的height为逻辑分辨率,手机有个物理分辨率,魅族手机:物理=逻辑*3

采用沉浸式状态栏

mui.plusReady(function() {var height1 = plus.android.invoke(plus.android.currentWebview(), "getHeight");//高度物理分辨率var height2 = plus.screen.resolutionHeight;//高度逻辑分辨率var top = plus.navigator.getStatusbarHeight();//状态栏高度document.getElementsByClassName("mui-content")[0].style.height = (height2) + "px";console.log(height1);//1920console.log(height2);//640console.log(top);//22});
不采用沉浸式状态栏

mui.plusReady(function() {var height1 = plus.android.invoke(plus.android.currentWebview(), "getHeight");//高度物理分辨率var height2 = plus.screen.resolutionHeight;//高度逻辑分辨率var top = plus.navigator.getStatusbarHeight();//状态栏高度document.getElementsByClassName("mui-content")[0].style.height = (height2-top) + "px";console.log(height1);//1920console.log(height2);//640console.log(top);//22});




原创粉丝点击