From 5bd6a6bbcc563a19dd8dd5b086044de16dc1b630 Mon Sep 17 00:00:00 2001 From: James Barnsley Date: Thu, 10 Nov 2016 08:08:03 +1300 Subject: [PATCH] Parallax updates --- src/js/components/Parallax.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/js/components/Parallax.js b/src/js/components/Parallax.js index 409b8fe0..88bff46f 100755 --- a/src/js/components/Parallax.js +++ b/src/js/components/Parallax.js @@ -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 ); }