javascript 当用户向下滚动页面时加载图像 -

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3723713/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-25 02:02:51  来源:igfitidea点击:

Load images when the user scrolls down the page -

javascriptjqueryhtml

提问by Thomas

I have been noticing a trend in blogs where the images don't load until you scroll down the page and the images appear in the view screen.

我一直在博客中注意到一种趋势,即在向下滚动页面并且图像出现在视图屏幕中之前,图像不会加载。

I imagine that this must be some sort of jquery magic, but after some googling I haven't been able to figure out how it works. Does anyone know how this is done?

我想这一定是某种 jquery 魔法,但经过一些谷歌搜索后,我无法弄清楚它是如何工作的。有谁知道这是怎么做的?

EDIT: If you want to see an example of this behavior, check out the portfolios on behance.com

编辑:如果您想查看此行为的示例,请查看 behance.com 上的投资组合

采纳答案by ACP

It's achieved with the jQuery plugin Lazy Load.

它是通过 jQuery 插件Lazy Load 实现的

also look at this question from the jquery forum

也从jquery论坛看这个问题

Look at a similar question Source: How to do the image fade-in effect upon scroll (like mashable.com)

看一个类似的问题 来源How to do the image Fade-in effect on scroll (like mashable.com)

回答by San

Try this one. Customize the effects as per your needs.

试试这个。根据您的需要自定义效果。

http://www.appelsiini.net/projects/lazyload

http://www.appelsiini.net/projects/lazyload