diff --git a/src/layouts/Header.js b/src/layouts/Header.js index 01402e30d5e77596bb16546ec2ec172182a71cc7..6e092c8880454ac78380bd7d08bdb0bd3cdc8450 100644 --- a/src/layouts/Header.js +++ b/src/layouts/Header.js @@ -93,13 +93,12 @@ class HeaderView extends PureComponent { } const scrollTop = document.body.scrollTop + document.documentElement.scrollTop; if (!this.ticking) { + this.ticking = true; requestAnimationFrame(() => { if (this.oldScrollTop > scrollTop) { this.setState({ visible: true, }); - this.scrollTop = scrollTop; - return; } if (scrollTop > 300 && visible) { this.setState({ @@ -115,7 +114,6 @@ class HeaderView extends PureComponent { this.ticking = false; }); } - this.ticking = false; }; render() {