-
This is a question Hi! I decided to update from version 0.2.2 to version 0.5.6 and a problem arose: In the previous version (0.2.2) when scrolling I could get in the onScroll method the ratio of the scrollable visible content to the content height of the entire content. I can't figure out how to find out the ratio of scrollable content to the entire block in the current version of the library? How I got it before:
How can I access the "Ratio" property in the current version? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Good day @AHTOHO4 :) This is a breaking change from You can calculate the ratio like this: const { scrollOffsetElement } = osInstance.elements();
const { overflowAmount } = osInstance.state();
const scrollRatio = {
x: (scrollOffsetElement.scrollLeft / overflowAmount.x) || 0,
y: (scrollOffsetElement.scrollTop / overflowAmount.y) || 0,
}; |
Beta Was this translation helpful? Give feedback.
-
Got it, thank you very much! |
Beta Was this translation helpful? Give feedback.
Good day @AHTOHO4 :)
This is a breaking change from
overlayscrollbars
v1.x
tov2.x
which is used under the hood ofoverlayscrollbars-react
.Since version
2
the library is not handling as many scrolling cases anymore and focuses only on the scrollbars.You can calculate the ratio like this: