html文件太慢,大型UL LI html文件加载非常慢

针对2.6MB的HTML菜单文件导致的加载慢问题,建议采用懒加载策略,仅加载用户可视区域的数据,其余内容通过Ajax按需加载。考虑使用Clusterize.js等库处理大数据列表,同时检查网站压缩、缓存设置,简化页面结构,提高加载效率。
摘要由CSDN通过智能技术生成

I have a 'menu' HTML page. The Menu contains Book names and its chapters. It is designed like a tree like structure, built using tags UL & LI. The file is 2.6mb. The file is loading very slow on to the website. Are there any suggestions to improve its load time. Thank you.

Talk1:

he is talking about a 2.6MB html file that has nothing but an unordered list.

Talk2:

That is insane. There are lots of ways to load that data on demand as user interacts with it.

Talk3:

Consider Clusterize.js, it should process any huge list without any problems, even if it's 2.6mb

Solutions1

One suggestion would be to only load the data that is visible to user and defer the loading of the rest to later time using ajax if that is possible.

Basically you load the top level items, then on click of any menu item you can make an ajax call to load it's children dynamically.

Talk1:

Lazy loading using javascript is definitely the way to go

Talk2:

Thanks for the suggestion. I will try it.

Solutions2

This is a very broad question to ask, without seeing the HTML or a representation there's no good way to answer this.

However, I can give some pointers:

check that compression is enabled for the website, or at least this

page.

simplify the structure check that the page has a good cache

header, so the client doesn't need to download it regularly

consider

using a dynamic page (json/jquery) that only loads the content of the

segment when it's clicked on. (as TeaCode suggests)

You mention C# and HTML5 in your tags, is this file auto-generated by a site?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值