Call on function when scrollbar reach bottom of the scrollbar window. My scrollbar thumb will dynamically change size depending on how much data the scrollbar is storing.
Is there an easy way to do this? window.scrollY seem to always be 0. I'm programming a react component with typescript.
The scrollbar is 200x200 inside a container div which is 500x500
componentDidMount() {
window.addEventListener('scroll', _.throttle((event)=>{
this.triggerWhenScrolledToBottom(event);
}, 500), false);
}
triggerWhenScrolledToBottom(event){
var heightBound = $(window ).height * 0.8
if (heightBound > window.scrollY)
console.log('test');
}
The problem with my code is that it doesn't detect if I reach the bottom of the scrollbar div.