简体   繁体   English

jQuery Mobile性能

[英]JQuery Mobile performance

My JQM application needs to display only content that never changes. 我的JQM应用程序只需要显示永远不变的内容。 That's why I've written a static website which is about (HTML file <= 500kb). 这就是为什么我写了一个关于静态网站的原因(HTML文件<= 500kb)。

I am using the multipage architecture. 我正在使用多页体系结构。 No own JavaScript is used. 没有使用自己的JavaScript。

The application works well on newer smartphones, but lags on older smartphones. 该应用程序在较新的智能手机上运行良好,但在较旧的智能手机上却落后。 Are there any ways to optimize the performance of JQM? 有什么方法可以优化JQM的性能?

(Split into different files is not wanted..) (不需要拆分成其他文件。)

Consider a case that you're developing your website to make it work with Opera Mini as well, and then you'll have to make your website rely less on JavaScript. 考虑一下您正在开发网站以使其也能与Opera Mini一起使用的情况,然后就必须减少网站对JavaScript的依赖。

If your website is actually a Mobile Webapp which substitutes a dedicated native app for smartphones that can't run it, you might want to make all your modules AMD-ready so that not all of your code gets downloaded at once. 如果您的网站实际上是一个Mobile Webapp,它代替了无法运行它的智能手机的专用本机应用程序,则您可能希望将所有模块都设置为AMD就绪的,这样就不会立即下载所有代码。

And since you mention that: 既然您提到了:

I've written a static website which is about (HTML file <= 500kb). 我已经写了一个静态网站,有关(HTML文件<= 500kb)。

I believe loading all that markup is not wise, if your target "old smartphones" have browsers which can handle Ajax, you can load page content selectively and maintain webapp state via hash-tagging the URLs. 我相信加载所有这些标记是不明智的,如果您的目标“旧智能手机”具有可以处理Ajax的浏览器,则可以通过对URL进行哈希标记来选择性地加载页面内容并维护webapp状态。

Obviously, there's no magic wand to fix the problem your facing except for some modifications that I've suggested. 显然,除了我建议的一些修改之外,没有魔术棒可以解决您面临的问题。 You may want to check Google's Closure Compiler and some tips from Yahoo . 您可能需要检查Google的Closure CompilerYahoo的一些技巧。 :) :)

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

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