I\'m trying to detect the position of the browser\'s scrollbar with JavaScript to decide where in the page the current view is. My guess is that I have to detect where the t
I think the following function can help to have scroll coordinate values:
const getScrollCoordinate = (el = window) => ({ x: el.pageXOffset || el.scrollLeft, y: el.pageYOffset || el.scrollTop, });
I got this idea from this answer with a little change.