Parallax updates

This commit is contained in:
James Barnsley
2016-11-10 08:08:03 +13:00
parent 62fcb3add6
commit 5bd6a6bbcc

View File

@ -44,6 +44,18 @@ export default class Parallax extends React.Component{
window.removeEventListener("scroll", this.handleScroll);
}
componentWillReceiveProps( nextProps ){
var url = helpers.sizedImages( nextProps.images ).huge;
this.setState({ url: url, image: false, loaded: false })
this.loadImage( url )
.then(
response => {
this.setState({ url: url, image: response, loaded: true })
this.updateCanvas( response )
}
)
}
handleResize(e){
this.updateCanvas( this.state.image );
}