Closed fybchristasker closed 5 years ago
页面刷新时在底部??然后往上滚动不显示吗???
刷新时在任何位置可以显示,但是当我滚动到window.scrollY为0时再往下翻滚就会出现这个问题
always 为 false 时,动画只会播放一次,,播放完后就不会再出现动画了,,,
http://react-component.github.io/scroll-anim/examples/simple.html, 只进入一次,没有问题啊。。。
一般确实不会有问题,我是在componentDidMount中监听了滚动事件,可能OverPack也是通过同样的方法实现的,滑到顶部再下来页面内容都不见了 const className = window.scrollY > 0 ? 'menu-sticky' : 'menu-transparent' window.addEventListener('scroll', this.onScrollHandler)
https://codesandbox.io/s/musing-lake-24dz8 第二个OverPack的问题与我情况相似
好的,,我这边看下。。
v2.5.8
将OverPack的always设为false后,会出现无法显示的情况 componentDidMount() { this.onScrollHandler = _.throttle(() => { const { headerColorClassName } = this.state const className = window.scrollY > 0 ? 'menu-sticky' : 'menu-transparent' if (headerColorClassName !== className) { this.setState({ headerColorClassName: className }) } }, 200) window.addEventListener('scroll', this.onScrollHandler) } 请问这个该如何解决?