Closed JumpAttacker closed 3 years ago
Is this what you want to achieve? https://codesandbox.io/s/react-fiddle-forked-h8fvx?file=/src/App.js
BTW. there are functions that you can call on the Scrollbars instance (that you can get a hold of using refs): scrollToTop scrollToBottom scrollToRight scrollToLeft
i dont need only to btm, some times i need to go not to the last element
and i told you about dat
i want to use scrollIntoView with options {block: 'center} but if im using it i got dat
for me is hard to use scrollToTop cuz my content height inside this scroll are dynamic
You can scroll into any position you like with Scrollbars.scrollTop(placeYouWantToScrollInto). See the Spring Scrollbars example that also uses rebound for a smoother effect. The options you wanted to use are experimental anyway and should not be used.
but you know easy way to get item's position inside scroll? I only know basic: item.height*x, but i have dynamic height on items, so its hard for me to calc all items (i know it possible, but easiest way to use just scrollIntoView)
Element.offsettop would be my first call. Anyway it's more like stackoverflow question than Scrollbars related. As described above, you are encouraged to use the API to scroll within it rather than using scrollInto etc. browser API. Otherwise you may see such artifacts as the original scrollbars being pulled from under the negative margins.
Unless you have any more issues to raise, I assume your case to be closed?
yes, thanks for help
When im using element.scrollIntoView(true)
scroll working is not correnctly
reproduce link https://codesandbox.io/s/react-fiddle-forked-bvesc?file=/src/App.js