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 did this for a element.scrollTop - is the pixels hidden in top due to the scroll. With no scroll its value is 0. element.scrollHeight - is the pixels of the whole div. element.clientHeight - is the pixels that you see in your browser. will be the position. will be the maximum value for scrollTop. will be the percent of scroll [from 0 to 1].var a = element.scrollTop;
var b = element.scrollHeight - element.clientHeight;
var c = a / b;