mirror of
https://github.com/kremalicious/portfolio.git
synced 2024-12-31 09:07:38 +01:00
project nav tweaks
This commit is contained in:
parent
dfe495eeac
commit
db6addcbe2
@ -20,17 +20,26 @@ class ProjectNav extends Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
|
||||
this.state = {
|
||||
scrolledToCurrent: false
|
||||
}
|
||||
|
||||
this.scrollToCurrent = this.scrollToCurrent.bind(this)
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.scrollToCurrent()
|
||||
this.setState({ scrolledToCurrent: true })
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
this.scrollToCurrent()
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
this.setState({ scrolledToCurrent: false })
|
||||
}
|
||||
|
||||
scrollToCurrent = () => {
|
||||
const current = this.currentItem
|
||||
const currentLeft = current.getBoundingClientRect().left
|
||||
|
Loading…
Reference in New Issue
Block a user