Browse Source

remove repeat hash jump

pull/7238/head
afc163 7 years ago
parent
commit
f9273bc95a
  1. 11
      site/theme/template/Content/MainContent.jsx

11
site/theme/template/Content/MainContent.jsx

@ -61,20 +61,9 @@ export default class MainContent extends React.Component {
if (!location.hash) {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
} else {
if (this.timer) {
clearTimeout(this.timer);
}
this.timer = setTimeout(() => {
document.getElementById(decodeURI(location.hash.replace('#', ''))).scrollIntoView();
}, 10);
}
}
componentWillUnmount() {
clearTimeout(this.timer);
}
handleMenuOpenChange = (openKeys) => {
this.setState({ openKeys });
}

Loading…
Cancel
Save