在jQuery Mobile中加载大型嵌套列表的最快方法是什么?(What's the fastest way to load a large nested list in jQuery M

编程入门 行业动态 更新时间:2024-10-27 08:34:50
在jQuery Mobile中加载大型嵌套列表的最快方法是什么?(What's the fastest way to load a large nested list in jQuery Mobile?)

我有一个大的嵌套数组,我通过在PHP中解析CSV文件生成。 我让它以JSON输出并让我的jQuery Mobile站点获取它,然后将其解析为DOM列表<ul> , <li> 。 这在我的桌面浏览器上运行良好,但似乎永远在我的移动设备上。

然后我让PHP脚本实际输出HTML,并将其粘贴到我的jQuery Mobile站点中,看看是否加快了速度。 这基本上删除了任何数据的提取。 index.html中只有一个非常大的嵌套<ul> 。 我认为这肯定会很快加载,但现在我的移动设备(Nexus One和Blackberry)似乎需要更长的时间

有什么方法可以加快速度吗? 这是一个演示http://pastehtml.com/view/bkrviwxp4.html

我在链接上尝试了数据预取,但这阻止了页面完全加载到黑莓上。

I have a large nested array that I'm generating from parsing a CSV file in PHP. I had it output it in JSON and had my jQuery Mobile site fetch it, then parse it into a DOM list <ul>, <li>. This worked fine on my desktop browser but seemed to take forever on my mobile devices.

So then I had the PHP script actually output the HTML, and pasted that in my jQuery Mobile site to see if that sped it up. This essentially removed the fetching of any data. The index.html simply has a very large nested <ul> in it. I figured this would definitely load quickly, but it seems to take even longer now on my mobile devices (Nexus One & Blackberry).

Is there any way to speed this up? Here's a demo http://pastehtml.com/view/bkrviwxp4.html

I tried data-prefetch on the link but that prevented the page from loading entirely on the blackberry.

最满意答案

正如我所看到的,您正在同时处理所有元素,但是您不会同时显示所有元素。 尝试仅处理并向DOM添加将要显示的这些元素。 JQuery-mobile本身非常慢,即使只有一对元素,你有数千个。

As I see, you're processing all elements at once, however you don't display them all at once. Try to process and add to DOM only these elements that will be displayed. JQuery-mobile is very slow by itself even if there's only a pair of elements, you have thousands.

更多推荐

<ul>,html,PHP,电脑培训,计算机培训,IT培训"/> <meta name="descripti

本文发布于:2023-08-02 18:41:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1379418.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:嵌套   加载   最快   方法   列表

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!