Draggable list with scroll #1641
Unanswered
emcfarlane
asked this question in
Support
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've got a draggable list that as you approach the edge of the page it scrolls the page along. I'd like to have the scroll and the position of the draggable item move smoothly together but am not sure how to tie the scroll position updates nicely to the position of the item. Sandbox below shows my attempt at making it work, although slightly janky.
https://codesandbox.io/s/romantic-satoshi-z8ugn?file=/src/App.tsx
Screen.Recording.2021-07-20.at.19.51.25.mov
Currently I'm using the window position to calculate the scroll movement:
let scrollDiff = window.scrollY - scrollY.current
wherescrollY.current
is set for the initial animation. It's failing to update the position of the draggable as it doesn't "know" about the scrolling animation.Any ideas on how to make the animation smooth? Thanks!
Beta Was this translation helpful? Give feedback.
All reactions