What is the best approach for navigating between pages in a mobile application [closed]

旧巷老猫 提交于 2020-01-15 10:59:11

问题


What is the best approach for changing pages in a multipage mobile application?

I have seen it done both ways (as shown below). I can't seem to understand which one is the best approach. Are there differences between the two?

$("#nextPage").load("myapp.html", function(){
  alert("loaded next page!");
});

Vs..

$('#currentPage').hide();
$('#nextPage').show();

回答1:


For the difference between what you've wrote in the question - see comment by @Japser, but in general:

I would say it depends on your app design, on "how far" you want to take it, on the framework you choose for developing it with (Sencha, jQuery Mobile, jQuery, Dojo, ...), etc...

If you "go simple", you can have 1 HTML file considered as your main page, and in it have a DIV which you will use jQuery's .load to replace its content with different content from other HTML files...

You can also use the jQuery Mobile approach for the same, which uses .changePage, etc... again, depending on what you actually want to do.

At the end, it depends on what you want to accomplish.
There is no one best approach.


And if you ever implement multi-page navigation in a Worklight-based project, it is highly important to remember that a Worklight application is a Single Page Application. You must not "leave" the Worklight context, or else you application will stop functioning. See more here: IBM Worklight 6.1 - Why is Cordova code not working when placed in a sub-page?



来源:https://stackoverflow.com/questions/21761767/what-is-the-best-approach-for-navigating-between-pages-in-a-mobile-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!