前端 - js 图片懒加载
巴扎黑
巴扎黑 2017-04-17 13:00:20
0
2
632

有一个手机页面,有很多屏图片,我们向下滚动,从第一屏滚到最后一屏,第一屏和最后一屏的图片会加载出来,但第一屏和最后一屏之间的图片不让加载出来,各们大神,不知道有什么方法可以实现?

巴扎黑
巴扎黑

reply all(2)
伊谢尔伦

This just requires setting a delay, commonly known as function throttling. That is, when a scroll event occurs, the image is not loaded immediately, but is delayed for a while. If there is a new scroll event during this period, the loading action of the previous event will be canceled.

小葫芦

Detect the distance between the top of the image container and the top of the browser window (if(offsetTop<0){**}). The computer is not nearby, so I don’t have an example for you. Please help me write it down.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!