且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在html中获取延迟加载效果到整页?

更新时间:2023-10-30 16:54:46

例如当使用 jQuery 时你可以使用如下所示的onscroll处理程序。

For example when using jQuery you could use an onscroll handler like the following one.

$(document).scroll(function() {

});

然后此函数使用 scrollTop 确定垂直滚动位置,并根据定义的偏移量使AJAX请求获取内容。

And this function then uses scrollTop to determine the vertical scroll position and on defined offsets it makes AJAX requests to get the content.