0

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.

  • Can you show what you did already, parts of your code when you try to achieve your issue ? – Ivo Sep 14 '18 at 07:48
  • Hi friend, I just added some code now. –  Sep 14 '18 at 07:52
  • Possible duplicate of [Detecting when user scrolls to bottom of div with React js](https://stackoverflow.com/questions/45585542/detecting-when-user-scrolls-to-bottom-of-div-with-react-js) – gazdagergo Sep 14 '18 at 08:18
  • Didn't work... Doesn't seem like it detects when it reaches the bottom. –  Sep 14 '18 at 08:34

0 Answers0