diff options
author | Victor Häggqvist <[email protected]> | 2016-01-14 22:57:23 +0100 |
---|---|---|
committer | Victor Häggqvist <[email protected]> | 2016-01-14 22:57:23 +0100 |
commit | 4b570dce9af4307eac2fe8d26323066215464ccd (patch) | |
tree | 6e25974db5281307d41bc616e1e8a38ec5e8d074 /src | |
parent | 382401d527314b270e1c67b4f88cd3bfbca81d46 (diff) |
fix undefined next preload
Diffstat (limited to 'src')
-rw-r--r-- | src/LightBox.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/LightBox.js b/src/LightBox.js index 5479819..e2094c1 100644 --- a/src/LightBox.js +++ b/src/LightBox.js @@ -216,10 +216,10 @@ export class LightBox { }, this.options.animationSpeed); if (this.options.preloadNext) { - let index = Array.prototype.indexOf.call(this.targets, this.target) + let index = Array.prototype.indexOf.call(this.targets, this.target); let next = this.targets[index + 1]; - if (next !== null) { + if (next !== null && next !== undefined) { log.debug('preloading next'); let nextImg = new Image(); nextImg.src = next.href; |