I have my code, and I cannot understand how can I detect end of scroll (when it gets to the bottom of the element).
document.getElementById('list').addEventListener('wheel', function () {
function load() {
var fragment = document.createDocumentFragment();
for (var i = 0; i < 10; i++) {
var p = document.createElement('p');
p.appendChild(document.createTextNode(i));
fragment.appendChild(p);
}
return fragment;
}
// if ( scroll end ) { load new content
this.appendChild(load());
//}
}, false);
Is there any best practice/algorithm for this task?