Commit 9d016cd9 by FE

srcoll modify

parent 4331b905
......@@ -78,8 +78,16 @@ class SearchResult extends PureComponent {
handleScroll = throttle(() => {
let y = window.scrollY,
headY = this.searchHead.current.offsetTop;
console.log(headY,'headY');
console.log(document.querySelector('body').offsetHeight);
// 向上滑动
if (y < this.prevScrollY && y > 0) {
console.log(0);
console.log(this.state.swipeDirection);
if (this.state.swipeDirection === this.swipeDown) {
console.log(1);
y <= headY && this.state.searchHeadStyle.position !== 'fixed' &&
this.setState({
searchHeadStyle: {
......@@ -88,19 +96,27 @@ class SearchResult extends PureComponent {
}
})
} else {
console.log(2);
this.setState({
swipeDirection: this.swipeDown
}, () => {
if (this.state.swipeDirection === this.swipeDown) {
let h = y > document.querySelector('body').offsetHeight? document.querySelector('body').offsetHeight: y;
let h1 = this.searchHead.current.offsetHeight
this.setState({
searchHeadStyle: {
top: `${y > headY ? y - 44 : y}px`
// top: `${h > headY ? h - h1 : h}px`
top: `${y}px`
}
})
}
})
}
} else {
console.log(3);
this.state.swipeDirection !== this.swipeUp &&
this.setState({
swipeDirection: this.swipeUp,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment