The `window.scrollY` is a problems!
Weibozzz opened this issue · comments
your code
const getScrollToBottomValue = (): number => {
if (!childrenRef || !childrenRef.current) return -1;
const scrollTop = window.scrollY; // is the pixels hidden in top due to the scroll. With no scroll its value is 0.
const scrollHeight = childrenRef.current.scrollHeight; // is the pixels of the whole container
return scrollHeight - scrollTop - window.innerHeight;
};
The window.scrollY
!It is limited to being used only in the window. If a scroll bar appears at a maximum height on its outer layer, it will not work