div の下部に到達する前にデータをロードし続けることができる動的スクロールを div に作成しようとしています。コードがまったく実行されていないため、私は耳の後ろでかなり濡れており、これを正しい方法で見ているかどうか確信が持てません。どんなガイダンスでも大歓迎です
function yHandler (){
var movelist = document.getElementById('movelist');
//turning div into an object
var contentHeight = movelist.offsetHeight;
//gets page content height, this so you know how much vetical pixel height you
//have on the page
var yOffset = movelist.pageYoffset;
//get vertical scroll position, lets you know where the user is in their scroll
//postion
var y = yOffset + movelist.innerHeight;
//getting inner height of div
if(y >= contentHeight){
//if the user scrolls to the bottom. If user goes over or hits it
movelist.innerHTML += '<div class ="newData">hey look at me</div>';
}
}
div.onscroll = yHandler;
//リッスンし、div が上下にスクロールされるたびに yHandler を起動します