Framer Motion Reford不允许拖动项目滚动容器

发布于 2025-01-24 09:17:12 字数 230 浏览 0 评论 0 原文

If you look at the example on framer motion docs for scrollable lists, when you drag the item outside the view of the container, the container does not scroll. I'm looking for a behavior similar to this example here by dnd toolkit. You can see in the dnd toolkit example if you drag the item beyond the container, then the container auto scrolls. Is there a way to replicate this auto-scroll behavior in framer-motion using the Reorder component?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

冰之心 2025-01-31 09:17:12

我遇到了同样的问题。我的临时工作是为了揭示 reorder.group.group 组件的高度,并允许身体通过解开其高度并允许页面溢出而不是元素而成长。这是一个示例:

https:// codesandbox 。

​鼠标车轮直至移动鼠标本身。我很想找到一个支持滚动和更新滚动而不是鼠标运动的解决方案,但这是我到目前为止能够提出的最好的!

如果您能够自己修复,希望您在这里分享您的解决方案。

I have been running into the same problem. My temporary work-around has been to unset the height on the Reorder.Group component and allow the body to grow by unsetting its height and allowing the page to overflow instead of the element. Here is an example:

https://codesandbox.io/s/framer-motion-5-drag-to-reorder-lists-scroll-jtlql2

Note that it isn't perfect: it does not support panning, and the animation does not trigger after scrolling with your mouse wheel until you move the mouse itself. I would love to find a solution that supports panning and updates on scroll rather than mouse movement, but this has been the best I've been able to come up with so far!

Would love for you to share your solution here if you were able to fix it yourself.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文