-
Notifications
You must be signed in to change notification settings - Fork 6
dev_fullscreen
quhbc edited this page Nov 10, 2016
·
10 revisions
#全屏显示 var y = $summer.offset($summer.byId('header')).h; var width=$summer.offset(document.getElementsByTagName("body")[0]).w;
var height = $summer.offset($summer.byId('main')).h
$summer.fixStatusBar($summer.byId('header'));
var height2 = $summer.offset($summer.byId('main')).h
//alert("height="+height+" height2="+height2);
summer.openFrame({
id: 'main',
url: 'html/main.html',
bounces: true,
rect: {
x: 0,
y: y,
w: width,
h: height2***//注意不能使用height***
}
});
解释:
1、首先通过配置文件设置app以全屏显示
2、$summer.fixStatusBar会调整header的pading-top为20,这样是为了header不至于和手机的statusbar重合。
3、此时再通过$summer.offset($summer.byId('main')).h获取此时的offsetHeight就是最终frame要显示的区域。因为在fixStatusBar之前整个window的高度比非全屏要多20,而header没有多出20,所以导致的结果是main所在的区域比非全屏时要多20,所以frame的高度应该是在fixStatusBar之后的main区域的高度才对。

