Browse Source

fix slide hidden Header bug (#2681)

* fix slide  hidden Header bug

Close :#2680

* Prevent repeated animation
pull/2684/head
xiaohuoni 8 years ago
committed by 陈帅
parent
commit
d57aae1829
  1. 4
      src/layouts/Header.js

4
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() {

Loading…
Cancel
Save