【问题标题】:JQuery Mobile - how to set up a loading page before website loadsJQuery Mobile - 如何在网站加载之前设置加载页面
【发布时间】:2012-08-15 05:14:12
【问题描述】:

我的网站上有一个FirstPage.html

当网站加载时(FirstPage.html 加载),我想显示 WelcomePage.html 至少 5 秒(即使 FirstPage.html 完成加载)。

有人可以帮忙吗!

【问题讨论】:

    标签: jquery jsp web-applications jquery-mobile pageload


    【解决方案1】:

    为什么不让WelcomePage.html成为实际的主页,然后在后台将FirstPage.html添加到jquery mobile DOM中。然后,在 X 秒后或页面完成加载到 DOM 后重定向到 FirstPage.html。

    这是文档:http://jquerymobile.com/test/docs/pages/page-cache.html

    更新

    使用 我给你的墨水,你需要在一个单独的JS文件中添加以下代码。

    $.mobile.loadPage( FirstPage.html, { showLoadMsg: false } );
    

    您需要在 WelcomePage.html 的头部包含这个 JS 文件,在您包含 jQuery 之后,但在您包含 jQuery mobile 之前。

    这会将 FirstPage.html 加载到 DOM 中。然后调用你的其他代码(我认为)

    【讨论】:

    • 我做了一个 WelcomePage.html 我已经添加了这个代码:pastebin.com/MLxb7nUw 这会起作用吗?还是我应该改变一些东西?
    • 嗨,亚当,根据您的链接,我之前的帖子运行良好。谢谢:)
    猜你喜欢
    • 2014-07-21
    • 1970-01-01
    • 2015-04-02
    • 2018-06-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多