如何最好地确定网页上 HTTP 请求的优先级?
我需要优先下载(就我而言)图像。
为此,我更愿意使用某种插件(最好是 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
假设实际页面将有超过三个图像,请看一下此图像延迟加载插件。它基于首屏下的内容和非首屏的内容,按顺序处理图像,并且可以配置为在滚动时预加载首屏下的 X 个图像。它允许使用占位符图像,但如果您希望它公开背景图像而不是处理实际的 img 标签,则可能需要进行一些重写。
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.
以下是“按需”加载或滚动到视图中时加载的示例。虽然没有直接回答你的问题,但基本相似。
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".