简体   繁体   English

jQuery Multi-Page控件显示的第一页

[英]JQuery Multi-Page control the first page displayed

I'm using JQuery Mobile's recommended multi-page approach to separate out pages. 我正在使用JQuery Mobile推荐的多页方法来分离出页面。 What I don't know (I'm a bit of JQuery and Javascipt noob) is how to control which page loads first. 我不知道(我有点JQuery和Javascipt noob)是如何控制首先加载哪个页面的。

I want to run a check to local storage for the user's credentials, which I can do, if they exist they can use the web app as usual, if not I want to navigate them to the login page. 我想对本地凭据运行检查,我可以这样做,如果它们存在,则他们可以照常使用Web应用程序;否则,我想将其导航到登录页面。 How can I do this before the first page is loaded? 在加载第一页之前,我该怎么做?

您可以将逻辑放入$(“#firstpage”)。live(“ pageshow”,function(){//重定向用户},其中firstpage是.html文件中第一个子页面的ID

You can simply call your function during onload of your page.Hope this helps. 您可以在页面加载期间简单地调用函数。希望这会有所帮助。 Check out this fiddle link. 查看此小提琴链接。 http://jsfiddle.net/Vinay/HPy3a/21/ http://jsfiddle.net/Vinay/HPy3a/21/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM