gpt4 book ai didi

javascript - 在下载 "big list of images"之前加载页面的所有 css 和 js

转载 作者:行者123 更新时间:2023-11-28 18:56:45 26 4
gpt4 key购买 nike

我有一个网站,在一个页面中显示大约 20 个自动播放的幻灯片列表(每个包含 4-5 张图片)。现在的问题是加载网站需要很长时间(当然会,因为有这么多图片)但我想首先优先加载所有必要的 css 和 js 文件,以便其他组件在图像开始下载之前,页面已正确呈现。

所以...有没有办法设置请求资源的优先加载顺序?

最佳答案

Is there a way to set a preferential order of loading of the requested resources

是的 - 将它们按此顺序放入您的 HTML 文件中!

I am wanting to preferentially load all the neccessary css and js files at first, so that the other components on the page are properly rendered before the images begin to download.

那是另外一个问题。

在知道大多数元素的尺寸之前,您的页面组件无法正确呈现。因此,如果您的页面布局中有其他图像,则需要先加载这些图像,或者在标记中指定它们的宽度和高度属性。

由于如果您使用纯 HTML 加载幻灯片图像,它们将与布局的其余部分混合在一起,这听起来您别无选择,只能从 Javascript 加载所有幻灯片图像,根据其他评论和答案.

关于javascript - 在下载 "big list of images"之前加载页面的所有 css 和 js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7602935/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com