JQuery Mobile - 如何在网站加载之前设置加载页面

时间:2012-08-19 16:28:18

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

我的网站上有FirstPage.html

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

任何人都可以帮忙!

1 个答案:

答案 0 :(得分:0)

为什么不将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 } );

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

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