How to get botton and top

1

I'm using angularjs and I have to get the top and botton of the scroll and the top and botton of the div that contains the scroll, all this to know if the scroll is completely down, My goal is to know if the scroll is below , with the following code I get for the div and how do I get it for the scroll?

document.querySelector('#divScroll').getBoundingClientRect()

note: I should not use jquery

    
asked by hubman 11.07.2017 в 01:55
source

1 answer

1

Good, with this you can get the height of the scroll bar:

var intElemScrollHeight = element.scrollHeight;

For more reference, I recommend this article:

link

Another property to use is scrollTop:

link

This is a basic example of how to detect that you arrived at the end of the scroll:

link

Your implementation may change a bit, depending on your html structure

I hope this is useful, otherwise, do not hesitate to ask again.

    
answered by 11.07.2017 / 02:14
source