How to programmatically scroll to a page when using ScrollControls #1093
Answered
by
sanojsilva
sanojsilva
asked this question in
Q&A
-
Hi, I'm using ScrollControls to scroll between different pages. I have a requirement to scroll to a particular page (section) when a button is clicked. I have tried native scrolling methods like el.scrollIntoView(), el.scrollTop(x, y) etc. But they don't work in this case. Is there a way to do this functionality when using ScrollControls? Thank you. |
Beta Was this translation helpful? Give feedback.
Answered by
sanojsilva
Oct 12, 2022
Replies: 1 comment
-
Got the answer from another thread. You can use scroll.el.scrollTo({top: [value]}) const scroll = useScroll();
....
scroll.el.scrollTo({top: 1000}) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
sanojsilva
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Got the answer from another thread. You can use scroll.el.scrollTo({top: [value]})