1window.onscroll = function() {
2 let d = document.documentElement;
3 let offset = d.scrollTop + window.innerHeight;
4 let height = d.offsetHeight;
5
6 console.log('offset = ' + offset);
7 console.log('height = ' + height);
8
9 if (offset >= height) {
10 console.log('At the bottom');
11 }
12};