Open livegp opened 1 year ago
Hey! I am also interested in this
Not sure what you meant by "if SimpleBar is not connected" but with the vanilla JS API it works like this:
const simpleBar = new SimpleBar(document.getElementById('myElement'));
simpleBar.getScrollElement().scrollTo(x, y)
for React
const scrollableNodeRef = React.useRef();
// then in a useCallback or useEffect
scrollableNodeRef.current.scrollTo(x, y);
<SimpleBar scrollableNodeProps={{ ref: scrollableNodeRef }}>
// your content
</SimpleBar>;
Hello! Thanks for the great library. How to combine SimpleBar and Scroll to Top
There is a Scroll to Top function that works only if SimpleBar is not connected. What settings are needed to fix this?