Open jabberfest opened 10 years ago
See:
https://developer.mozilla.org/en-US/docs/Web/API/Element.scrollHeight https://developer.mozilla.org/en-US/docs/Web/API/Element.clientHeight
The following will get you subpixel values for scrollHeight and clientHeight but it only works on IE9+. The solution I propose at least works with older browsers.
@jamesflorentino, @kristerkari any thoughts?
element.getBoundingClientRect() Element.getBoundingClientRect().
@jabberfest Thanks! I'll have to test this in different browsers to verify the fix.
I just realized that my approach breaks the scroll event that fires when the scroll bar is at the beginning. this is due to me just adding a 1 pixel offset
Oh yeah true, then we need to think about an alternative solution.
In certain cases the "scrollend" event is never fired. Chrome and Firefox rounds values down for scrollTop.
In some cases contentScrollTop is one less than maxScroll top despite being scrolled all the way down.