帖子
帖子
用户
博客
课程
显示全部楼层
9
帖子
0
勋章
28
Y币

[其他] 写了引导页以后,点返回会出现白屏现象,

[复制链接]
发表于 2017-10-18 09:44:45
<!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"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>引导页</title>
    <link rel="stylesheet" type="text/css" href="./css/api.css"/>
    <link rel="stylesheet" type="text/css" href="./css/style.css"/>
</head>
<body>

</body>
</html>
<script type="text/javascript" src="script/api.js"></script>
<script type="text/javascript">
apiready = function(){
    api.setWinAttr({
            bounces: false
        });
        api.setStatusBarStyle({
              style: 'light',
              color: '#fff'
          });

        var header=$api.dom('body').offsetHeight;
        var $header=$api.dom('body');
        var iosheader=$header.offsetHeight;
        $api.fixStatusBar( $header);
        indexOrGuide();
}
function indexOrGuide(iosheader,header){

        if ($api.getStorage('firsttimez')) {
          var header = document.querySelector('.header');
          $api.fixStatusBar(header);
              api.openWin({
                name: 'win_home',
                url: 'http://fx**.**/mobile',
                bounces: false,
                rect: {
                    x: 0,
                      y: 0,
                      w: 'auto',
                      h: 'auto'
                }
            });
          } else {
              api.openFrameGroup({
                  name: 'guide',
                  background: '#dabb85',
                  scrollEnabled: true,
                  bounces: false,
                  rect: {
                      x: 0,
                      y: 0,
                      w: 'auto',
                      h: 'auto'
                  },
                  index: 0,
                  frames:[
                      {
                          name: 'guide1',
                          url: './html/guide/guide1.html',
                          pageParam:{},
                          bounces:false,
                          opaque:true,
                          vScrollBarEnabled:false,
                          hScrollBarEnabled:false,
                          bgColor: './res/guide_p1.jpg'
                      },{
                          name: 'guide2',
                          url: './html/guide/guide2.html',
                          pageParam:{},
                          bounces:false,
                          opaque:true,
                          vScrollBarEnabled:false,
                          hScrollBarEnabled:false,
                          bgColor: './res/guide_p2.jpg'
                      },{
                          name: 'guide3',
                          url: './html/guide/guide3.html',
                          pageParam:{},
                          bounces:false,
                          opaque:true,
                          vScrollBarEnabled:false,
                          hScrollBarEnabled:false,
                          bgColor: './res/guide_p3.jpg'
                      },{
                          name: 'guide4',
                          url: './html/guide/guide4.html',
                          pageParam:{},
                          bounces:false,
                          opaque:true,
                          vScrollBarEnabled:false,
                          hScrollBarEnabled:false,
                          bgColor: './res/guide_p4.jpg'
                      }
                  ]
              }, function(ret, err){
                  var name = ret.name;
                  var index = ret.index;
                  $api.setStorage('firsttimez',true);
              });
          }
    };

</script>
这个是引导页的代码,就是在首页点击返回后,会出现白屏现象,再点一下就会提示出现是否退出程序

4
帖子
0
勋章
3524
Y币
白屏是你 的 index.html入口页的背景色吧,已经退到入口页了,在入口页写些效果就不会有问题了
9
帖子
0
勋章
28
Y币
piewun949116 发表于 2017-10-18 10:28
白屏是你 的 index.html入口页的背景色吧,已经退到入口页了,在入口页写些效果就不会有问题了 ...

在哪里改呀 ?
42
帖子
1
勋章
1万+
Y币

                        api.addEventListener({
                                name : 'keyback'
                        }, function(ret, err) {
                                api.toast({
                                        msg : '再点一哈退出应用',
                                        duration : 2000,
                                        location : 'bottom'
                                });
                                api.addEventListener({
                                        name : 'keyback'
                                }, function(ret, err) {
                                        api.closeWidget({
                                                silent : true
                                        });
                                });
                                setTimeout(function() {
                                        exitApp();
                                }, 2000)
                        });


这样引导页进入首页后 就不能再返回引导页以及引导页之前的页面


9
帖子
0
勋章
28
Y币
川哥哥 发表于 2017-10-18 17:34
api.addEventListener({
                                name : 'keyback'
   ...

放在那里呀 ?
42
帖子
1
勋章
1万+
Y币

方在引导也和首页apiready = function(){    } 里面
9
帖子
0
勋章
28
Y币
川哥哥 发表于 2017-10-19 12:39
方在引导也和首页apiready = function(){    } 里面

还是不行呀
9
帖子
0
勋章
28
Y币
  exitApp();是什么?
42
帖子
1
勋章
1万+
Y币
moumoum 发表于 2017-10-19 14:52
exitApp();是什么?

退出函数                function exitApp() {
                        api.addEventListener({
                                name : 'keyback'
                        }, function(ret, err) {
                                api.toast({
                                        msg : '再点一哈退出应用',
                                        duration : 2000,
                                        location : 'bottom'
                                });
                                api.addEventListener({
                                        name : 'keyback'
                                }, function(ret, err) {
                                        api.closeWidget({
                                                id : 'A6050645862705',
                                                retData : {
                                                        name : 'closeWidget'
                                                },
                                                silent : true
                                        });
                                });
                                setTimeout(function() {
                                        exitApp();
                                }, 3000)
                        });
                }

您需要登录后才可以回帖 登录

本版积分规则