【问题标题】:Is it possible to figure out how to scroll to the top of a Flex Box that has Reverse-Column set as Flex Direction?是否可以弄清楚如何滚动到将 Reverse-Column 设置为 Flex Direction 的 Flex Box 的顶部?
【发布时间】:2022-11-12 09:42:35
【问题描述】:

因此,如果我有一个高度为 100% 且可滚动的 Flex 框,我希望能够检测到它何时到达顶部。这很简单,就像您拥有flex-direction: column 一样,您只需检查event.target.scrollTop 属性并查看它是否为0。但是,如果您将flex-direction 设置为“column-reverse”,则滚动到顶部会产生较小的负值(-1000、-1100、-1200 等),向下滚动时,它会产生 0。

有什么办法可以弄清楚我怎样才能到达顶峰?

【问题讨论】:

    标签: html css flexbox


    【解决方案1】:

    有同样的问题。你能解决这个问题吗?知道为什么向上滚动时 scrollTop 会变得越来越消极吗?

    【讨论】:

      猜你喜欢
      • 2016-11-19
      • 2021-11-25
      • 2017-08-30
      • 2019-11-18
      • 1970-01-01
      • 2018-11-04
      • 1970-01-01
      • 1970-01-01
      • 2020-09-01
      相关资源
      最近更新 更多