【问题标题】:How to position useTransition sidebar to the extreme right如何将 useTransition 侧边栏定位到最右侧
【发布时间】:2021-07-28 13:10:19
【问题描述】:

我正在尝试将此侧边栏放置在与当前正在执行的操作相反的位置。我希望侧边栏从右侧进入并始终保持正确。没有离开。

这是供您复制的沙盒链接 - https://codesandbox.io/s/react-spring-sidebar-transition-forked-igmgr

谢谢。

【问题讨论】:

    标签: reactjs react-spring


    【解决方案1】:

    首先将侧边栏放在右侧。

    .sidebar {
      position: absolute;
      right:0;
    }
    

    将变换更改为正 x 方向

    from: {
      transform: "translateX(100%)"
    },
    enter: {
      transform: `translateX(0)`
    },
    leave: {
      transform: "translateY(100%)"
    },
    

    【讨论】:

    • overflow: hidden 添加到body 或其他一些容器作为侧边栏也可能是避免滚动条的好主意
    猜你喜欢
    • 1970-01-01
    • 2018-04-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多