延迟加载插件以用户滚动加载图像? [英] lazy load plugin to load images as user scrolls?
问题描述
我真的很喜欢这个懒惰的加载插件,而且我觉得它不适用于新的浏览器。
I really like the lazy load plugin and I am gutted it's not working on new browsers.
无论如何,我可以编写自己的代码,在用户滚动之前不会将图像加载到折叠下方吗?
Is there anyway I can write my own code that doesn't load the images below the fold until the user scrolls?
<img _src="/fullscreen/img/You are everywhere 2.png" class='lazyLoad' />
jQuery('.lazyLoad').each(function(){
var _elm= jQuery(this);
_elm.attr('src',_elm.attr('_src'));
//on DOM ready loop through each
//image with class=lazyLoad and add src attribute to it.
})
如果能得到这个钉子会很棒,很可惜 appelsiini网站。
It would be great if I can get this nailed, it's a pity the appelsiini site isn't supported any longer.
我发现一个适用于所有浏览器的网站 http:// haw-lin.com/ 它正在使用一个非常相似的插件脚本来 http:// www。 appelsiini.net/projects/lazyload 。没有麻省理工学院的许可证,我发现很难解读。
I found a site that works in all browsers http://haw-lin.com/ and it's using a very similar plugin script to http://www.appelsiini.net/projects/lazyload. There's no MIT license and I find it difficult to decipher.
你能推荐什么jQuery图像延迟加载插件?
What jQuery image lazy load plugin can you recommend?
推荐答案
jQuery图像延迟加载插件的演示页面在Mac上的FF3.6似乎不适合我。我正在使用Firebug的Net选项卡观看HTTP请求,我可以看到加载的所有图像都已加载。
The demo page of jQuery image lazy load plugin doesn't seem to work to me on FF3.6 on Mac. I was watching the HTTP requests with the Net tab of Firebug and I could see all the images loaded onload.
你可以查看这个名为 JAIL 完美运行(但需要进行一些HTML更改)。
我特别建议查看示例。
You can check out this plugin called JAIL that works perfectly (requires some HTML changes though). I especially suggest to look at the the examples.
这篇关于延迟加载插件以用户滚动加载图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!