Jquery-mobile and Phonegap Best Technique

本秂侑毒 提交于 2019-12-11 03:49:32

问题


I am working with jqmobile and phonegap. While developing mobile web applications is normally recommended to use the multipage technique, that is, put different pages inside the same .html file so that the transitions go faster. However, as long as I´m using phonegap (so every html file is contained in the apk LOCALLY in each mobile phone), is it also recommended to use multipage technique? Is it faster to put more than one file inside the same .html using jqmobile with phonegap?

Regards,


回答1:


In my honest opinion, jQuery Mobile is not the best tool to use in PhoneGap based apps. jQM is dependent on jQuery which contains a lot of code that is not really required when you are building a mobile app. There is code in there that supports IE and Firefox but since the big three mobile phone OS'es (iOS, Android, BB) are all WebKit based it is just over kill.

However, if I was going to use jQM in my PG app I would use a single page approach if at all possible. This will prevent a couple of common issues that people see when using jQM/PG. For instance when you navigate to a second page the transitions are not always great on the mobile device, they are particularly bad on Android. As well when you app moves to page two it has to reload jQuery, jQuery Mobile and PhoneGap and this takes time. So if you can fit everything into one page by doing show/hide div's it would be better performance wise. If you need to go to a second page look at loading it via AJAX into the current pages DOM.

Also if you are on Android you may want to disable some CSS to get things to run smoother.

https://stackoverflow.com/a/8212384/41679



来源:https://stackoverflow.com/questions/12581872/jquery-mobile-and-phonegap-best-technique

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