|
使用FrameGroup中页面背景实现起始页多页切换,页面流畅程度高于纯Html页面背景实现方式。
1.使用FrameGroup做起始页的容器
api.openFrameGroup({
name : 'welcome',
bounces : false,
index : 0,
rect : {
x : 0,
y : 0,
w : 'auto',
h : 'auto'
},
scrollEnabled : true,
frames : [{
name : 'welcome_1',
url : './html/welcome/welcome_1.html',
bounces : false,
opaque : true,
vScrollBarEnabled : true,
hScrollBarEnabled : true,
bgColor : './res/start00.png' //此处使用frame背景图方式做页面
}, {
name : 'welcome_2',
url : './html/welcome/welcome_2.html',
bounces : false,
opaque : true,
vScrollBarEnabled : true,
hScrollBarEnabled : true,
bgColor : './res/start01.png'
}, {
name : 'welcome_3',
url : './html/welcome/welcome_3.html',
bounces : false,
opaque : true,
vScrollBarEnabled : true,
hScrollBarEnabled : true,
bgColor : './res/start02.png'
}, {
name : 'welcome_4',
url : './html/welcome/welcome_4.html',
bounces : false,
opaque : true,
vScrollBarEnabled : true,
hScrollBarEnabled : true,
bgColor : './res/start03.png'
}]
}, function(ret, err) {
var index = ret.index;
var name = ret.name;
if (index == 0) {
$api.setStorage('MyfirstStart', true);
}
});
2.每个页面使用透明背景
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
<title>APP</title>
<link rel="stylesheet" type="text/css" href="../../css/api.css" />
<style>
img{
width:100%;
height:100%;
margin:0;
padding:0;
overflow:hidden;
}
body,html,#wrap{
height: 100%;
width: 100%;
background:transparent !important;
}
</style>
</head>
<body>
<div id="wrap">
<!--<img src='../../res/start00.png'/>-->
</div>
</body>
</html>
3.利用一个本地变量存储首次运行状态,当运行完毕后设置状态值。第二次检测状态后隐藏frameGroup。
4.最后一个页面增加点击事件,开启你的主页。
|
本帖子中包含更多资源,您需要 登录 才可以下载或查看,没有帐号?立即注册
X
|