简体   繁体   English

不支持Javascript / Jquery延迟加载。facebook如何做到这一点?

[英]Javascript/Jquery Lazy load not supported..How does facebook do it?

So I am trying to implement a basic image lazy load feature to speed up the loading of my website. 因此,我正在尝试实现基本的图像延迟加载功能,以加快网站的加载速度。 From what I understand the Jquery plugin lazyload worked for a while but is no longer supported for new browsers. 据我了解,jQuery插件lazyload可以工作一段时间,但新浏览器不再支持。

My question is simple: 我的问题很简单:

How do other sites do it then? 那其他站点怎么做呢? Sites such as facebook do have support for this type of thing, so there has to be an answer out there. 诸如Facebook之类的网站确实支持这种事情,因此必须有一个答案。 I'm aware that they have full teams of developers for this sort of thing, but with all of the complexities of javascript there has to be a feasible solution. 我知道他们有足够的开发人员团队来完成这种事情,但是由于javascript的所有复杂性,必须有一个可行的解决方案。

So does anyone have a patch for the lazyload plugin or a way to do it that works? 那么,有没有人为lazyload插件提供补丁或有效的方法? It would be greatly appreciated. 这将不胜感激。 Thank you. 谢谢。

EDIT 编辑

My previous research seemed to indicate that all of the tutorials were using the same plugin since there are many that are named similarly. 我以前的研究似乎表明,所有教程都使用相同的插件,因为有许多名称相似。 However there are many differing variations and I was unclear in my original question. 但是,有许多不同的变体,我在最初的问题中不清楚。

I will try to find a cross-browser solution based on the suggestions below and post it here to make this post more useful for others. 我将尝试根据以下建议找到跨浏览器的解决方案,并将其发布在此处,以使本帖子对其他人更有用。

Try this on for size: http://ivorycity.com/blog/2011/04/19/jquery-lazy-loader-load-html-and-images-on-scroll/ 试试看这个尺寸: http : //ivorycity.com/blog/2011/04/19/jquery-lazy-loader-load-html-and-images-on-scroll/

Worked fine for me in Chrome. 在Chrome中对我来说效果很好。

尝试Ryan Grove的LazyLoad库http://github.com/rgrove/lazyload/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM