如何最好地确定网页上 HTTP 请求的优先级?

发布于 2024-08-11 01:19:43 字数 549 浏览 7 评论 0原文

我需要优先下载(就我而言)图像。

为此,我更愿意使用某种插件(最好是 jQuery),它可以让我无需构建自己的下载队列机制即可完成此操作。

考虑这种情况:

您有一个网页。 您的网页能够向给定用户显示三个图像。 这些图像仅根据用户请求一次显示一张。

理想情况下,您希望从上到下加载图像,直到用户做出选择。然后,您会希望他的选择在队列中向上移动并成为下一个(他所做的每一个选择)。

当然,在只有三个图像的页面中这并不是真正的问题,但随着图像越来越多,它变得很重要。

我目前仅使用背景图像来显示图像,并希望保持这种状态。

哦,还有,我希望在加载图像时显示“spinner.gif”。

有什么建议吗?

谢谢。

更新 我最终基于此制作了自己的排队系统: http://jqueryfordesigners.com/image-loading/< /a>

I need to prioritize the downloading of (in my case) images.

To do this I would prefer to use some kind of plugin (preferably for jQuery) that lets me do this without having to build my own downloadqueue mechanism.

Consider this scenario:

You have a web page.
Your web page is able to show a given user three images.
These images are only shown one at a time at the users request.

You would then ideally want to load the images from top to bottom until the user makes a selection. You would then want his selection to move up the queue and become next in line (with every selection he makes).

Of course in a page with only three images this isn't really a problem, but with more and more images it becomes important.

I am currently only using background-image to show images and would like to keep it that way.

Oh, and also, I would like a "spinner.gif" to show while an image is loading.

Any suggestions?

Thanks.

UPDATE
I ended up making my own queueing system based on this: http://jqueryfordesigners.com/image-loading/

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

淡笑忘祈一世凡恋 2024-08-18 01:19:43

Assuming the actual page will have a lot more than three images, take a look at this image Lazy Load Plugin . It's based around what is and what is not below the fold, works sequentially through the images, and can be configured to preload in X ones below the fold as you are scrolling. It allows for a placeholder image but might need some rewriting if you want it to expose background images rather than working on actual img tags.

我的鱼塘能养鲲 2024-08-18 01:19:43

以下是“按需”加载或滚动到视图中时加载的示例。虽然没有直接回答你的问题,但基本相似。

http://www.webresourcesdepot.com/dnspinger/

尝试向下滚动,页面会加载我的内容。也适用于图像。
此演示的资源可以在“滚动时加载内容”中找到jQuery”。

Here's an example of loading 'on-demand' or when scrolled into view. Though not directly answering your question but is fundamentally similar.

http://www.webresourcesdepot.com/dnspinger/

Try scrolling down and the page gets loaded with my content. Will work for images as well.
The resource for this demo can be found at "Load Content While Scrolling With jQuery".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文