有一个手机页面,有很多屏图片,我们向下滚动,从第一屏滚到最后一屏,第一屏和最后一屏的图片会加载出来,但第一屏和最后一屏之间的图片不让加载出来,各们大神,不知道有什么方法可以实现?
伊谢尔伦2017-04-17 13:02:20
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.
高洛峰2017-04-17 13:02:20
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.