【问题标题】:Phonegap Build ios 6 iphone 5 splash not going awayPhonegap Build ios 6 iphone 5 splash 不会消失
【发布时间】:2013-03-10 19:31:51
【问题描述】:

大家好,我已经创建了一个在 android 上运行良好的 android/iphone 应用程序,但由于某种原因,它只是显示了启动屏幕/加载动画,而没有超过它。

这是屏幕的样子:

在我的 config.xml 文件中:

<!--App settings -->
    <preference name="phonegap-version"                                     value="2.3.0" />
    <preference name="orientation"                                          value="portrait" />
    <preference name="fullscreen"                                           value="true" />
    <preference name="exit-on-suspend"                                      value="true" />
    <preference name="auto-hide-splash-screen"                              value="false" />
    <preference name="splash-screen-duration"                               value="10000" />
    <preference name="webviewbounce"                                        value="true" />

在我的 javascript 中我有:

    //Wait for device
    function onDeviceReady() {
        navigator.splashscreen.hide();
    }

    document.addEventListener("deviceready", onDeviceReady, false);

但是,我将这段代码用于 index.html 文件:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=310;" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<title></title>
</head>

<body>
<script>
    window.location='https://fb.zzzzzzz.com/xxxxxx/index.php';
</script>
</body>
</html>

我缺少什么设置?可能是因为我在 .html 之后调用了一个 .php 页面?

【问题讨论】:

  • 你试过删除那个调用 .php 文件的脚本吗?

标签: android jquery ios cordova phonegap-build


【解决方案1】:

在触发和处理设备就绪事件后,它对我有用。

JavaScript

var app = {
    // Application Constructor
    initialize: function() {
        this.bindEvents();
    },
    // Bind Event Listeners
    //
    // Bind any events that are required on startup. Common events are:
    // 'load', 'deviceready', 'offline', and 'online'.
    bindEvents: function() {
        document.addEventListener('deviceready', this.onDeviceReady, false);
    },
    // deviceready Event Handler
    //
    // The scope of 'this' is the event. In order to call the 'receivedEvent'
    // function, we must explicity call 'app.receivedEvent(...);'
    onDeviceReady: function() {
        app.receivedEvent('deviceready');
    },
    // Update DOM on a Received Event
    receivedEvent: function(id) {
        var parentElement = document.getElementById(id);
        var listeningElement = parentElement.querySelector('.listening');
        var receivedElement = parentElement.querySelector('.received');

        listeningElement.setAttribute('style', 'display:none;');
        receivedElement.setAttribute('style', 'display:block;');

        console.log('Received Event: ' + id);
        window.location='https://fb.zzzzzzz.com/xxxxxx/index.php';
    }
};

HTML

<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript">
    app.initialize();
</script>

【讨论】:

    猜你喜欢
    • 2023-03-22
    • 1970-01-01
    • 1970-01-01
    • 2014-11-03
    • 2015-08-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-17
    相关资源
    最近更新 更多