angularscroll-position

let pos = (document.documentElement.scrollTop || document.body.scrollTop) + document.documentElement.offsetHeight;


this line doesn't show me the exact position of the scroller in the first time it shows 687 as the position in the second click it shows the same location as 617 it doesn't change after the second click.


Solution

  • onScroll(event: any) { //visible height + pixel scrolled = total height if (event.target.offsetHeight + event.target.scrollTop == event.target.scrollHeight) { this.buttonDisabled=false;

        }
        else
        {
                 this.buttonDisabled=true;
    
        }
    }