帖子
帖子
用户
博客
课程
123下一页
返回列表 发新帖
显示全部楼层
89
帖子
0
勋章
1万+
Y币

FrameGroup加页面背景实现起始页

[复制链接]
发表于 2015-8-16 02:07:57
使用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
8
帖子
0
勋章
1万+
Y币
感谢分享
89
帖子
0
勋章
1万+
Y币
自己顶一下!
46
帖子
0
勋章
214
Y币
试试,我的纯html老是不流畅,显示白底
39
帖子
0
勋章
842
Y币
要是来个截图就好了!
9
帖子
0
勋章
1833
Y币
你和我发的一样啊!
27
帖子
0
勋章
469
Y币
很不错   谢谢分享
6
帖子
0
勋章
151
Y币
在哪个文件中定义了本地啊变量?
能截个图吗?
希望新手能明白这个道理
17
帖子
0
勋章
122
Y币
苹果真机测试没有图片
123下一页
您需要登录后才可以回帖 登录

本版积分规则