Jquery-mobile和Phonegap最佳技术 [英] Jquery-mobile and Phonegap Best Technique

查看:128
本文介绍了Jquery-mobile和Phonegap最佳技术的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jqmobile和phonegap。虽然开发移动Web应用程序通常建议使用multipage技术,即将不同的页面放在同一个.html文件中,以便转换更快。然而,只要我使用phonegap(所以每个html文件都包含在每个手机的apk LOCAL),是否也建议使用多页技术?使用jqmobile和phonegap将多个文件放在同一个.html中会更快吗?



注意,

解决方案

在我的老实说,jQuery Mobile不是最好的工具,用于基于PhoneGap的应用程序。 jQM依赖于jQuery,它包含了很多代码,当你正在构建一个移动应用程序并不是真正需要的。有代码在那里支持IE和Firefox,但由于大三手机操作系统(iOS,Android,BB)都是基于WebKit的,它只是过度杀。



<但是,如果我要在我的PG应用程序中使用jQM,我将使用单页方法,如果可能的话。这将防止人们在使用jQM / PG时看到的几个常见问题。例如,当您导航到第二页时,过渡在移动设备上并不总是很好,它们在Android上尤其糟糕。还有当你的应用程序移动到第二页,它必须重新加载jQuery,jQuery Mobile和PhoneGap,这需要时间。所以如果你可以通过做显示/隐藏div将一切都放在一个页面,这将是更好的性能明智。如果你需要去第二页看看通过AJAX加载到当前页面DOM。



此外,如果你是在Android上,你可能想禁用一些CSS让事情更流畅。



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


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,

解决方案

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.

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

这篇关于Jquery-mobile和Phonegap最佳技术的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆