From d5be455a3e6687444b69161d0427cd6401d67048 Mon Sep 17 00:00:00 2001 From: James Barnsley Date: Fri, 20 Jan 2017 13:27:49 +1300 Subject: [PATCH] Parallax only load when we have an image URL --- src/js/components/Parallax.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/js/components/Parallax.js b/src/js/components/Parallax.js index 61589845..0b4d53e7 100755 --- a/src/js/components/Parallax.js +++ b/src/js/components/Parallax.js @@ -56,7 +56,7 @@ export default class Parallax extends React.Component{ } componentWillReceiveProps( nextProps ){ - if( ( !this.state.url || nextProps.image != this.state.url ) && !this._loading ){ + if( ( !this.state.url || nextProps.image != this.state.url ) && !this._loading && nextProps.image ){ this._loading = true this.setState({ url: nextProps.image, image: false, loading: true }) this.loadImage( nextProps.image ) @@ -109,6 +109,7 @@ export default class Parallax extends React.Component{ } updateCanvas( image ){ + var canvasWidth = $('.parallax').outerWidth(); var canvasHeight = $('.parallax').outerHeight(); if( this.state.canvas.width != canvasWidth || this.state.canvas.height != canvasHeight ){