jQuery延迟加载图像以节流吗? [英] jQuery lazy loading image with throttling?

查看:81
本文介绍了jQuery延迟加载图像以节流吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经获得了一个与商业会员相关的网站的设计,该网站的首页上有2500多个图片.我正在考虑简化图像加载的两个方向是利用惰性图像加载脚本.

I've been given a design for a commercial affiliate-related website where the homepage has 2500+ images on it. Two directions I'm thinking about to ease the loading of the images is to utilize a lazy image loading script.

我一直在使用jQuery JAIL(异步图像加载程序)脚本.我进行了设置,以便在页面加载时加载所有可见图像.然后几秒钟后,它开始下载页面上所有未折叠的图像.通常就像2400张以上的图片.

I've been messing with the jQuery JAIL (Async Image Loader) script. I have it set so that it loads all the visible images when the page loads. Then after a couple seconds it begins downloading all the rest of the images on the page that are below the fold. This is typically like 2400+ images.

问题在于,当浏览器被告知要下载2400张图像时,它基本上冻结了,或者至少冻结了滚动条,直到完成为止.

The problem is that when the browser is told to download 2400 images it basically freezes up, or at least freezes up the scrollbar until it's done.

是否有任何类似于JAIL但允许某种类型的节流的jQuery图像加载脚本?冻结页面真的有什么帮助.

Are there any jQuery image loading scripts that are similar to the JAIL but that allow for some type of throttling? Anything really to help from freezing up the page.

我也在研究CSS精灵,但是由于各种技术原因和时间限制,它可能不可行.

I'm also looking into css sprites but for various technical reasons and time constraints it might not be feasible.

推荐答案

使用此 jQuery插件 .示例此处 这会延迟长网页中图像的加载.视口外(网页的可见部分)的图像将不会在用户滚动到它们之前加载.

Use this jQuery plugin. Example here It delays loading of images in long web pages. Images outside of viewport (visible part of web page) wont be loaded before user scrolls to them.

在包含许多大图像的长网页上使用延迟加载可以使页面加载更快.加载可见图像后,浏览器将处于就绪状态.在某些情况下,它还可以帮助减少服务器负载.

Using Lazy Load on long web pages containing many large images makes the page load faster. Browser will be in ready state after loading visible images. In some cases it can also help to reduce server load.

这篇关于jQuery延迟加载图像以节流吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆