in order to make a scrolling page, it is similar to the lazy loading effect.
Thepage has many P tags, gets the offsetTop location values of all P tags, and saves the array
var items=$("p");
var arr_h = [];
for (var i=0; i<items.length; iPP){
arr_h.push(items[i].offsetTop);
};
the result is:
console.log(arr_h); [16, 548, 1080, 1612]
then get the scroll bar drop-down position, the question is, how to write judgment?
$(window).scroll(function(){
var scrollTop = $(document).scrollTop();
//console.log(scrollTop); 0 1 2 3 .....100....1000
//
if(scrollTop == arr_h){
console.log();
}else{
console.log();
}
});